Skip to content

Commit

Permalink
Build and test Docker on IBM Power and Z using gccgo. Enable CI on Po…
Browse files Browse the repository at this point in the history
…wer and Z.

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
  • Loading branch information
brahmaroutu committed Nov 14, 2015
1 parent 1396395 commit b1cc78b
Show file tree
Hide file tree
Showing 12 changed files with 204 additions and 14 deletions.
88 changes: 88 additions & 0 deletions Dockerfile.ppc64le
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# This file describes the standard way to build Docker, using docker
#
# Usage:
#
# # Assemble the full dev environment. This is slow the first time.
# docker build -t docker -f Dockerfile.ppc64le .
#

FROM ppc64le/gcc:5.2

# Packaged dependencies
RUN apt-get update && apt-get install -y \
apparmor \
aufs-tools \
btrfs-tools \
build-essential \
curl \
git \
iptables \
net-tools \
libapparmor-dev \
libcap-dev \
libsqlite3-dev \
mercurial \
parallel \
python-mock \
python-pip \
python-websocket \
--no-install-recommends

RUN rm -rf /usr/local/lvm2
RUN git clone --no-checkout git://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2 && cd /usr/local/lvm2 && git checkout -q v2_02_103
RUN curl -o /usr/local/lvm2/autoconf/config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'
RUN curl -o /usr/local/lvm2/autoconf/config.sub 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'

# Compile and install lvm2
RUN cd /usr/local/lvm2 \
&& ./configure --enable-static_link \
&& make device-mapper \
&& make install_device-mapper

ENV GOPATH /go:/go/src/github.com/docker/docker/vendor

ENV REGISTRY_COMMIT ec87e9b6971d831f0eff752ddb54fb64693e51cd
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
&& rm -rf "$GOPATH"

# Install notary server
ENV NOTARY_COMMIT 8e8122eb5528f621afcd4e2854c47302f17392f7
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_COMMIT") \
&& GOPATH="$GOPATH/src/github.com/docker/notary/Godeps/_workspace:$GOPATH" \
go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
&& rm -rf "$GOPATH"

# Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT 47ab89ec2bd3bddf1221b856ffbaff333edeabb4
RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \
&& git checkout -q $DOCKER_PY_COMMIT \
&& pip install -r test-requirements.txt

# Add an unprivileged user to be used for tests which need it
RUN groupadd -r docker
RUN useradd --create-home --gid docker unprivilegeduser

VOLUME /var/lib/docker
WORKDIR /go/src/github.com/docker/docker
ENV DOCKER_BUILDTAGS apparmor selinux

ENV IMAGEREPO ppc64le
COPY contrib/download-frozen-image.sh /go/src/github.com/docker/docker/contrib/
RUN ./contrib/download-frozen-image.sh /docker-frozen-images \
$IMAGEREPO/busybox:latest \
$IMAGEREPO/hello-world:frozen

# Wrap all commands in the "docker-in-docker" script to allow nested containers
ENTRYPOINT ["hack/dind"]

# Upload docker source
COPY . /go/src/github.com/docker/docker
87 changes: 87 additions & 0 deletions Dockerfile.s390x
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# This file describes the standard way to build Docker, using docker
#
# Usage:
#
# # Assemble the full dev environment. This is slow the first time.
# docker build -t docker -f Dockerfile.s390x .
#

FROM s390x/gcc:5.2

# Packaged dependencies
RUN apt-get update && apt-get install -y \
apparmor \
aufs-tools \
btrfs-tools \
build-essential \
curl \
git \
iptables \
net-tools \
libapparmor-dev \
libcap-dev \
libsqlite3-dev \
mercurial \
parallel \
python-mock \
python-pip \
python-websocket \
--no-install-recommends

# Get lvm2 source for compiling statically
RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
# see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags

# Compile and install lvm2
RUN cd /usr/local/lvm2 \
&& ./configure --enable-static_link \
&& make device-mapper \
&& make install_device-mapper

ENV GOPATH /go:/go/src/github.com/docker/docker/vendor

ENV REGISTRY_COMMIT ec87e9b6971d831f0eff752ddb54fb64693e51cd
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
&& rm -rf "$GOPATH"

# Install notary server
ENV NOTARY_COMMIT 8e8122eb5528f621afcd4e2854c47302f17392f7
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_COMMIT") \
&& GOPATH="$GOPATH/src/github.com/docker/notary/Godeps/_workspace:$GOPATH" \
go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
&& rm -rf "$GOPATH"

# Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT 47ab89ec2bd3bddf1221b856ffbaff333edeabb4
RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \
&& git checkout -q $DOCKER_PY_COMMIT \
&& pip install -r test-requirements.txt

# Add an unprivileged user to be used for tests which need it
RUN groupadd -r docker
RUN useradd --create-home --gid docker unprivilegeduser

VOLUME /var/lib/docker
WORKDIR /go/src/github.com/docker/docker
ENV DOCKER_BUILDTAGS apparmor selinux

ENV IMAGEREPO s390x
COPY contrib/download-frozen-image.sh /go/src/github.com/docker/docker/contrib/
RUN ./contrib/download-frozen-image.sh /docker-frozen-images \
$IMAGEREPO/busybox:latest \
$IMAGEREPO/hello-world:frozen

# Wrap all commands in the "docker-in-docker" script to allow nested containers
ENTRYPOINT ["hack/dind"]

# Upload docker source
COPY . /go/src/github.com/docker/docker
2 changes: 1 addition & 1 deletion hack/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ ORIG_BUILDFLAGS=( -a -tags "autogen netgo static_build sqlite_omit_load_extensio
# see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here
BUILDFLAGS=( $BUILDFLAGS "${ORIG_BUILDFLAGS[@]}" )
# Test timeout.
: ${TIMEOUT:=60m}
: ${TIMEOUT:=120m}
TESTFLAGS+=" -test.timeout=${TIMEOUT}"

LDFLAGS_STATIC_DOCKER="
Expand Down
9 changes: 9 additions & 0 deletions hack/make/.ensure-images
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
for image in `docker images | awk '{print $1}'`; do
if ( [ -z "${image##$IMAGEREPO/busybox}" ] ); then
docker tag $image busybox:latest
docker rmi $image
elif ( [ -z "${image##$IMAGEREPO/hello-world}" ] ); then
docker tag $image:frozen hello-world:frozen
docker rmi $image:frozen
fi
done
1 change: 1 addition & 0 deletions hack/make/.integration-daemon-setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

bundle .ensure-emptyfs
bundle .ensure-frozen-images
bundle .ensure-images
bundle .ensure-httpserver
2 changes: 2 additions & 0 deletions hack/make/gccgo
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ source "${MAKEDIR}/.go-autogen"
if [[ "${BUILDFLAGS[@]}" =~ 'netgo ' ]]; then
EXTLDFLAGS_STATIC+=' -lnetgo'
fi
# gccgo require explicit flag -pthread to allow goroutines to work.
go build -compiler=gccgo \
-o "$DEST/$BINARY_FULLNAME" \
"${BUILDFLAGS[@]}" \
Expand All @@ -18,6 +19,7 @@ go build -compiler=gccgo \
$EXTLDFLAGS_STATIC
-Wl,--no-export-dynamic
-ldl
-pthread
" \
./docker

Expand Down
2 changes: 1 addition & 1 deletion integration-cli/docker_cli_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (s *DockerSuite) TestEventsUntag(c *check.C) {
dockerCmd(c, "rmi", "utest:tag1")
dockerCmd(c, "rmi", "utest:tag2")
eventsCmd := exec.Command(dockerBinary, "events", "--since=1")
out, exitCode, _, err := runCommandWithOutputForDuration(eventsCmd, time.Duration(time.Millisecond*200))
out, exitCode, _, err := runCommandWithOutputForDuration(eventsCmd, time.Duration(time.Millisecond*500))
c.Assert(err, checker.IsNil)
c.Assert(exitCode, checker.Equals, 0, check.Commentf("Failed to get events"))
events := strings.Split(out, "\n")
Expand Down
2 changes: 1 addition & 1 deletion integration-cli/docker_cli_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2903,7 +2903,7 @@ func (s *DockerSuite) TestRunUnshareProc(c *check.C) {

/* Ensure still fails if running privileged with the default policy */
name = "crashoverride"
if out, _, err := dockerCmdWithError("run", "--privileged", "--security-opt", "apparmor:docker-default", "--name", name, "jess/unshare", "unshare", "-p", "-m", "-f", "-r", "mount", "-t", "proc", "none", "/proc"); err == nil || !strings.Contains(out, "Permission denied") {
if out, _, err := dockerCmdWithError("run", "--privileged", "--security-opt", "apparmor:docker-default", "--name", name, "jess/unshare", "unshare", "-p", "-m", "-f", "-r", "mount", "-t", "proc", "none", "/proc"); err == nil || !(strings.Contains(out, "Permission denied") || strings.Contains(out, "Operation not permitted")) {
c.Fatalf("unshare should have failed with permission denied, got: %s, %v", out, err)
}
}
Expand Down
4 changes: 2 additions & 2 deletions integration-cli/docker_cli_run_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
select {
case err := <-errChan:
c.Assert(err, check.IsNil)
case <-time.After(30 * time.Second):
case <-time.After(600 * time.Second):
c.Fatal("Timeout waiting for container to die on OOM")
}
}
Expand All @@ -260,7 +260,7 @@ func (s *DockerSuite) TestRunWithoutMemoryswapLimit(c *check.C) {
testRequires(c, DaemonIsLinux)
testRequires(c, memoryLimitSupport)
testRequires(c, swapMemorySupport)
dockerCmd(c, "run", "-m", "16m", "--memory-swap", "-1", "busybox", "true")
dockerCmd(c, "run", "-m", "32m", "--memory-swap", "-1", "busybox", "true")
}

func (s *DockerSuite) TestRunWithSwappiness(c *check.C) {
Expand Down
7 changes: 5 additions & 2 deletions integration-cli/docker_cli_save_load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ func (s *DockerSuite) TestSaveImageId(c *check.C) {

c.Assert(tarCmd.Start(), checker.IsNil, check.Commentf("tar failed with error: %v", err))
c.Assert(saveCmd.Start(), checker.IsNil, check.Commentf("docker save failed with error: %v", err))
defer saveCmd.Wait()
defer tarCmd.Wait()
defer func() {
saveCmd.Wait()
tarCmd.Wait()
dockerCmd(c, "rmi", repoName)
}()

out, _, err = runCommandWithOutput(grepCmd)

Expand Down
2 changes: 1 addition & 1 deletion integration-cli/docker_cli_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (s *DockerSuite) TestVersionPlatform_w(c *check.C) {
// ensure the Linux daemon return the correct platform string
func (s *DockerSuite) TestVersionPlatform_l(c *check.C) {
testRequires(c, DaemonIsLinux)
testVersionPlatform(c, "linux/amd64")
testVersionPlatform(c, "linux")
}

func testVersionPlatform(c *check.C, platform string) {
Expand Down
12 changes: 6 additions & 6 deletions pkg/integration/dockerCmd_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@ func (s *DockerCmdSuite) TestDockerCmdWithTimeout(c *check.C) {
{
"doesnotexists",
[]string{},
100 * time.Millisecond,
200 * time.Millisecond,
`Command doesnotexists not found.`,
1,
fmt.Errorf(`"" failed with errors: exit status 1 : "Command doesnotexists not found."`),
},
{
dockerBinary,
[]string{"an", "error"},
100 * time.Millisecond,
200 * time.Millisecond,
`an error has occurred`,
1,
fmt.Errorf(`"an error" failed with errors: exit status 1 : "an error has occurred"`),
Expand All @@ -195,7 +195,7 @@ func (s *DockerCmdSuite) TestDockerCmdWithTimeout(c *check.C) {
{
dockerBinary,
[]string{"run", "-ti", "ubuntu", "echo", "hello"},
100 * time.Millisecond,
200 * time.Millisecond,
"hello",
0,
nil,
Expand Down Expand Up @@ -282,15 +282,15 @@ func (s *DockerCmdSuite) TestDockerCmdInDirWithTimeout(c *check.C) {
{
"doesnotexists",
[]string{},
100 * time.Millisecond,
200 * time.Millisecond,
`Command doesnotexists not found.`,
1,
fmt.Errorf(`"dir:%s" failed with errors: exit status 1 : "Command doesnotexists not found."`, tempFolder),
},
{
dockerBinary,
[]string{"an", "error"},
100 * time.Millisecond,
200 * time.Millisecond,
`an error has occurred`,
1,
fmt.Errorf(`"dir:%s an error" failed with errors: exit status 1 : "an error has occurred"`, tempFolder),
Expand All @@ -306,7 +306,7 @@ func (s *DockerCmdSuite) TestDockerCmdInDirWithTimeout(c *check.C) {
{
dockerBinary,
[]string{"run", "-ti", "ubuntu", "echo", "hello"},
100 * time.Millisecond,
200 * time.Millisecond,
"hello",
0,
nil,
Expand Down

0 comments on commit b1cc78b

Please sign in to comment.