Browse code

Merge pull request #17459 from brahmaroutu/Power_Z_CI

Build and test Docker on IBM Power and Z using gccgo. Enable CI on Po…

Michael Crosby authored on 2015/11/20 08:50:07
Showing 12 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,88 @@
0
+# This file describes the standard way to build Docker, using docker
1
+#
2
+# Usage:
3
+#
4
+# # Assemble the full dev environment. This is slow the first time.
5
+# docker build -t docker -f Dockerfile.ppc64le .
6
+#
7
+
8
+FROM ppc64le/gcc:5.2
9
+
10
+# Packaged dependencies
11
+RUN apt-get update && apt-get install -y \
12
+	apparmor \
13
+	aufs-tools \
14
+	btrfs-tools \
15
+	build-essential \
16
+	curl \
17
+	git \
18
+	iptables \
19
+	net-tools \
20
+	libapparmor-dev \
21
+	libcap-dev \
22
+	libsqlite3-dev \
23
+	mercurial \
24
+	parallel \
25
+	python-mock \
26
+	python-pip \
27
+	python-websocket \
28
+	--no-install-recommends
29
+
30
+RUN rm -rf /usr/local/lvm2
31
+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
32
+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'
33
+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'
34
+
35
+# Compile and install lvm2
36
+RUN cd /usr/local/lvm2 \
37
+	&& ./configure --enable-static_link \
38
+	&& make device-mapper \
39
+	&& make install_device-mapper
40
+
41
+ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
42
+
43
+ENV REGISTRY_COMMIT ec87e9b6971d831f0eff752ddb54fb64693e51cd
44
+RUN set -x \
45
+	&& export GOPATH="$(mktemp -d)" \
46
+	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
47
+	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
48
+	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
49
+		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
50
+	&& rm -rf "$GOPATH"
51
+
52
+# Install notary server
53
+ENV NOTARY_COMMIT 8e8122eb5528f621afcd4e2854c47302f17392f7
54
+RUN set -x \
55
+	&& export GOPATH="$(mktemp -d)" \
56
+	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
57
+	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_COMMIT") \
58
+	&& GOPATH="$GOPATH/src/github.com/docker/notary/Godeps/_workspace:$GOPATH" \
59
+		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
60
+	&& rm -rf "$GOPATH"
61
+
62
+# Get the "docker-py" source so we can run their integration tests
63
+ENV DOCKER_PY_COMMIT 47ab89ec2bd3bddf1221b856ffbaff333edeabb4
64
+RUN git clone https://github.com/docker/docker-py.git /docker-py \
65
+	&& cd /docker-py \
66
+	&& git checkout -q $DOCKER_PY_COMMIT \
67
+	&& pip install -r test-requirements.txt
68
+
69
+# Add an unprivileged user to be used for tests which need it
70
+RUN groupadd -r docker
71
+RUN useradd --create-home --gid docker unprivilegeduser
72
+
73
+VOLUME /var/lib/docker
74
+WORKDIR /go/src/github.com/docker/docker
75
+ENV DOCKER_BUILDTAGS apparmor selinux
76
+
77
+ENV IMAGEREPO ppc64le
78
+COPY contrib/download-frozen-image.sh /go/src/github.com/docker/docker/contrib/
79
+RUN ./contrib/download-frozen-image.sh /docker-frozen-images \
80
+	$IMAGEREPO/busybox:latest \
81
+	$IMAGEREPO/hello-world:frozen 
82
+
83
+# Wrap all commands in the "docker-in-docker" script to allow nested containers
84
+ENTRYPOINT ["hack/dind"]
85
+
86
+# Upload docker source
87
+COPY . /go/src/github.com/docker/docker
0 88
new file mode 100644
... ...
@@ -0,0 +1,87 @@
0
+# This file describes the standard way to build Docker, using docker
1
+#
2
+# Usage:
3
+#
4
+# # Assemble the full dev environment. This is slow the first time.
5
+# docker build -t docker -f Dockerfile.s390x .
6
+#
7
+
8
+FROM s390x/gcc:5.2
9
+
10
+# Packaged dependencies
11
+RUN apt-get update && apt-get install -y \
12
+	apparmor \
13
+	aufs-tools \
14
+	btrfs-tools \
15
+	build-essential \
16
+	curl \
17
+	git \
18
+	iptables \
19
+	net-tools \
20
+	libapparmor-dev \
21
+	libcap-dev \
22
+	libsqlite3-dev \
23
+	mercurial \
24
+	parallel \
25
+	python-mock \
26
+	python-pip \
27
+	python-websocket \
28
+	--no-install-recommends
29
+
30
+# Get lvm2 source for compiling statically
31
+RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
32
+# see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
33
+
34
+# Compile and install lvm2
35
+RUN cd /usr/local/lvm2 \
36
+	&& ./configure --enable-static_link \
37
+	&& make device-mapper \
38
+	&& make install_device-mapper
39
+
40
+ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
41
+
42
+ENV REGISTRY_COMMIT ec87e9b6971d831f0eff752ddb54fb64693e51cd
43
+RUN set -x \
44
+	&& export GOPATH="$(mktemp -d)" \
45
+	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
46
+	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
47
+	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
48
+		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
49
+	&& rm -rf "$GOPATH"
50
+
51
+# Install notary server
52
+ENV NOTARY_COMMIT 8e8122eb5528f621afcd4e2854c47302f17392f7
53
+RUN set -x \
54
+	&& export GOPATH="$(mktemp -d)" \
55
+	&& git clone https://github.com/docker/notary.git "$GOPATH/src/github.com/docker/notary" \
56
+	&& (cd "$GOPATH/src/github.com/docker/notary" && git checkout -q "$NOTARY_COMMIT") \
57
+	&& GOPATH="$GOPATH/src/github.com/docker/notary/Godeps/_workspace:$GOPATH" \
58
+		go build -o /usr/local/bin/notary-server github.com/docker/notary/cmd/notary-server \
59
+	&& rm -rf "$GOPATH"
60
+
61
+# Get the "docker-py" source so we can run their integration tests
62
+ENV DOCKER_PY_COMMIT 47ab89ec2bd3bddf1221b856ffbaff333edeabb4
63
+RUN git clone https://github.com/docker/docker-py.git /docker-py \
64
+	&& cd /docker-py \
65
+	&& git checkout -q $DOCKER_PY_COMMIT \
66
+	&& pip install -r test-requirements.txt
67
+
68
+# Add an unprivileged user to be used for tests which need it
69
+RUN groupadd -r docker
70
+RUN useradd --create-home --gid docker unprivilegeduser
71
+
72
+VOLUME /var/lib/docker
73
+WORKDIR /go/src/github.com/docker/docker
74
+ENV DOCKER_BUILDTAGS apparmor selinux
75
+
76
+ENV IMAGEREPO s390x
77
+COPY contrib/download-frozen-image.sh /go/src/github.com/docker/docker/contrib/
78
+RUN ./contrib/download-frozen-image.sh /docker-frozen-images \
79
+	$IMAGEREPO/busybox:latest \
80
+	$IMAGEREPO/hello-world:frozen 
81
+
82
+# Wrap all commands in the "docker-in-docker" script to allow nested containers
83
+ENTRYPOINT ["hack/dind"]
84
+
85
+# Upload docker source
86
+COPY . /go/src/github.com/docker/docker
... ...
@@ -140,7 +140,7 @@ ORIG_BUILDFLAGS=( -a -tags "autogen netgo static_build sqlite_omit_load_extensio
140 140
 # see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here
141 141
 BUILDFLAGS=( $BUILDFLAGS "${ORIG_BUILDFLAGS[@]}" )
142 142
 # Test timeout.
143
-: ${TIMEOUT:=60m}
143
+: ${TIMEOUT:=120m}
144 144
 TESTFLAGS+=" -test.timeout=${TIMEOUT}"
145 145
 
146 146
 LDFLAGS_STATIC_DOCKER="
147 147
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+for image in `docker images | awk '{print $1}'`; do
1
+if ( [ -z "${image##$IMAGEREPO/busybox}" ] ); then
2
+	docker tag $image busybox:latest
3
+	docker rmi $image
4
+elif ( [ -z "${image##$IMAGEREPO/hello-world}" ] ); then
5
+	docker tag $image:frozen hello-world:frozen
6
+	docker rmi $image:frozen
7
+fi
8
+done
... ...
@@ -2,4 +2,5 @@
2 2
 
3 3
 bundle .ensure-emptyfs
4 4
 bundle .ensure-frozen-images
5
+bundle .ensure-images
5 6
 bundle .ensure-httpserver
... ...
@@ -10,6 +10,7 @@ source "${MAKEDIR}/.go-autogen"
10 10
 if [[ "${BUILDFLAGS[@]}" =~ 'netgo ' ]]; then
11 11
 	EXTLDFLAGS_STATIC+=' -lnetgo'
12 12
 fi
13
+# gccgo require explicit flag -pthread to allow goroutines to work.
13 14
 go build -compiler=gccgo \
14 15
 	-o "$DEST/$BINARY_FULLNAME" \
15 16
 	"${BUILDFLAGS[@]}" \
... ...
@@ -18,6 +19,7 @@ go build -compiler=gccgo \
18 18
 		$EXTLDFLAGS_STATIC
19 19
 		-Wl,--no-export-dynamic
20 20
 		-ldl
21
+		-pthread
21 22
 	" \
22 23
 	./docker
23 24
 
... ...
@@ -53,7 +53,7 @@ func (s *DockerSuite) TestEventsUntag(c *check.C) {
53 53
 	dockerCmd(c, "rmi", "utest:tag1")
54 54
 	dockerCmd(c, "rmi", "utest:tag2")
55 55
 	eventsCmd := exec.Command(dockerBinary, "events", "--since=1")
56
-	out, exitCode, _, err := runCommandWithOutputForDuration(eventsCmd, time.Duration(time.Millisecond*200))
56
+	out, exitCode, _, err := runCommandWithOutputForDuration(eventsCmd, time.Duration(time.Millisecond*500))
57 57
 	c.Assert(err, checker.IsNil)
58 58
 	c.Assert(exitCode, checker.Equals, 0, check.Commentf("Failed to get events"))
59 59
 	events := strings.Split(out, "\n")
... ...
@@ -2868,7 +2868,7 @@ func (s *DockerSuite) TestRunUnshareProc(c *check.C) {
2868 2868
 
2869 2869
 	/* Ensure still fails if running privileged with the default policy */
2870 2870
 	name = "crashoverride"
2871
-	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") {
2871
+	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")) {
2872 2872
 		c.Fatalf("unshare should have failed with permission denied, got: %s, %v", out, err)
2873 2873
 	}
2874 2874
 }
... ...
@@ -233,7 +233,7 @@ func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
233 233
 	select {
234 234
 	case err := <-errChan:
235 235
 		c.Assert(err, check.IsNil)
236
-	case <-time.After(30 * time.Second):
236
+	case <-time.After(600 * time.Second):
237 237
 		c.Fatal("Timeout waiting for container to die on OOM")
238 238
 	}
239 239
 }
... ...
@@ -255,7 +255,7 @@ func (s *DockerSuite) TestRunWithoutMemoryswapLimit(c *check.C) {
255 255
 	testRequires(c, DaemonIsLinux)
256 256
 	testRequires(c, memoryLimitSupport)
257 257
 	testRequires(c, swapMemorySupport)
258
-	dockerCmd(c, "run", "-m", "16m", "--memory-swap", "-1", "busybox", "true")
258
+	dockerCmd(c, "run", "-m", "32m", "--memory-swap", "-1", "busybox", "true")
259 259
 }
260 260
 
261 261
 func (s *DockerSuite) TestRunWithSwappiness(c *check.C) {
... ...
@@ -131,8 +131,11 @@ func (s *DockerSuite) TestSaveImageId(c *check.C) {
131 131
 
132 132
 	c.Assert(tarCmd.Start(), checker.IsNil, check.Commentf("tar failed with error: %v", err))
133 133
 	c.Assert(saveCmd.Start(), checker.IsNil, check.Commentf("docker save failed with error: %v", err))
134
-	defer saveCmd.Wait()
135
-	defer tarCmd.Wait()
134
+	defer func() {
135
+		saveCmd.Wait()
136
+		tarCmd.Wait()
137
+		dockerCmd(c, "rmi", repoName)
138
+	}()
136 139
 
137 140
 	out, _, err = runCommandWithOutput(grepCmd)
138 141
 
... ...
@@ -35,7 +35,7 @@ func (s *DockerSuite) TestVersionPlatform_w(c *check.C) {
35 35
 // ensure the Linux daemon return the correct platform string
36 36
 func (s *DockerSuite) TestVersionPlatform_l(c *check.C) {
37 37
 	testRequires(c, DaemonIsLinux)
38
-	testVersionPlatform(c, "linux/amd64")
38
+	testVersionPlatform(c, "linux")
39 39
 }
40 40
 
41 41
 func testVersionPlatform(c *check.C, platform string) {
... ...
@@ -171,7 +171,7 @@ func (s *DockerCmdSuite) TestDockerCmdWithTimeout(c *check.C) {
171 171
 		{
172 172
 			"doesnotexists",
173 173
 			[]string{},
174
-			100 * time.Millisecond,
174
+			200 * time.Millisecond,
175 175
 			`Command doesnotexists not found.`,
176 176
 			1,
177 177
 			fmt.Errorf(`"" failed with errors: exit status 1 : "Command doesnotexists not found."`),
... ...
@@ -179,7 +179,7 @@ func (s *DockerCmdSuite) TestDockerCmdWithTimeout(c *check.C) {
179 179
 		{
180 180
 			dockerBinary,
181 181
 			[]string{"an", "error"},
182
-			100 * time.Millisecond,
182
+			200 * time.Millisecond,
183 183
 			`an error has occurred`,
184 184
 			1,
185 185
 			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) {
195 195
 		{
196 196
 			dockerBinary,
197 197
 			[]string{"run", "-ti", "ubuntu", "echo", "hello"},
198
-			100 * time.Millisecond,
198
+			200 * time.Millisecond,
199 199
 			"hello",
200 200
 			0,
201 201
 			nil,
... ...
@@ -282,7 +282,7 @@ func (s *DockerCmdSuite) TestDockerCmdInDirWithTimeout(c *check.C) {
282 282
 		{
283 283
 			"doesnotexists",
284 284
 			[]string{},
285
-			100 * time.Millisecond,
285
+			200 * time.Millisecond,
286 286
 			`Command doesnotexists not found.`,
287 287
 			1,
288 288
 			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) {
290 290
 		{
291 291
 			dockerBinary,
292 292
 			[]string{"an", "error"},
293
-			100 * time.Millisecond,
293
+			200 * time.Millisecond,
294 294
 			`an error has occurred`,
295 295
 			1,
296 296
 			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) {
306 306
 		{
307 307
 			dockerBinary,
308 308
 			[]string{"run", "-ti", "ubuntu", "echo", "hello"},
309
-			100 * time.Millisecond,
309
+			200 * time.Millisecond,
310 310
 			"hello",
311 311
 			0,
312 312
 			nil,