瀏覽代碼

Build and test Docker on IBM Power and Z using gccgo. Enable CI on Power and Z.
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>

Srini Brahmaroutu 10 年之前
父節點
當前提交
b1cc78b8f5

+ 88 - 0
Dockerfile.ppc64le

@@ -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 - 0
Dockerfile.s390x

@@ -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

+ 1 - 1
hack/make.sh

@@ -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="

+ 9 - 0
hack/make/.ensure-images

@@ -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 - 0
hack/make/.integration-daemon-setup

@@ -2,4 +2,5 @@
 
 bundle .ensure-emptyfs
 bundle .ensure-frozen-images
+bundle .ensure-images
 bundle .ensure-httpserver

+ 2 - 0
hack/make/gccgo

@@ -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[@]}" \
@@ -18,6 +19,7 @@ go build -compiler=gccgo \
 		$EXTLDFLAGS_STATIC
 		-Wl,--no-export-dynamic
 		-ldl
+		-pthread
 	" \
 	./docker
 

+ 1 - 1
integration-cli/docker_cli_events_test.go

@@ -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")

+ 1 - 1
integration-cli/docker_cli_run_test.go

@@ -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)
 	}
 }

+ 2 - 2
integration-cli/docker_cli_run_unix_test.go

@@ -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")
 	}
 }
@@ -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) {

+ 5 - 2
integration-cli/docker_cli_save_load_test.go

@@ -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)
 

+ 1 - 1
integration-cli/docker_cli_version_test.go

@@ -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) {

+ 6 - 6
pkg/integration/dockerCmd_utils_test.go

@@ -171,7 +171,7 @@ 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."`),
@@ -179,7 +179,7 @@ func (s *DockerCmdSuite) TestDockerCmdWithTimeout(c *check.C) {
 		{
 			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"`),
@@ -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,
@@ -282,7 +282,7 @@ 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),
@@ -290,7 +290,7 @@ func (s *DockerCmdSuite) TestDockerCmdInDirWithTimeout(c *check.C) {
 		{
 			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),
@@ -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,