Browse code

Fix release scripts

Add some missing dependencies in the Dockerfile:
- apt-utils for apt-ftparchive.conf
- bsdmainutils for our use of the column command in
hack/make/generate-index-listing

We also ensure that the docker daemon is started before calling
release-deb or release-rpm, since .detect-daemon-osarch, which is sourced
in each of them, requires the daemon to be running.

This commit also gets completely rid of s3cmd and fixes references to
AWS_* environment variables (changing from AWS_ACCESS_KEY to
AWS_ACCESS_KEY_ID and AWS_SECRET_KEY to AWS_SECRET_ACCESS_KEY) in order
to please awscli. Also AWS_DEFAULT_REGION is now important to specify,
the default has been set to the region used by get.docker.com and
test.docker.com.

Signed-off-by: Tibor Vass <tibor@docker.com>

Tibor Vass authored on 2016/03/25 23:54:36
Showing 8 changed files
... ...
@@ -38,9 +38,11 @@ RUN echo deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main > /etc/apt/s
38 38
 # Packaged dependencies
39 39
 RUN apt-get update && apt-get install -y \
40 40
 	apparmor \
41
+	apt-utils \
41 42
 	aufs-tools \
42 43
 	automake \
43 44
 	bash-completion \
45
+	bsdmainutils \
44 46
 	btrfs-tools \
45 47
 	build-essential \
46 48
 	clang-3.8 \
... ...
@@ -64,12 +66,12 @@ RUN apt-get update && apt-get install -y \
64 64
 	python-mock \
65 65
 	python-pip \
66 66
 	python-websocket \
67
-	s3cmd=1.5.0* \
68 67
 	ubuntu-zfs \
69 68
 	xfsprogs \
70 69
 	libzfs-dev \
71 70
 	tar \
72 71
 	--no-install-recommends \
72
+	&& pip install awscli==1.10.15 \
73 73
 	&& ln -snf /usr/bin/clang-3.8 /usr/local/bin/clang \
74 74
 	&& ln -snf /usr/bin/clang++-3.8 /usr/local/bin/clang++
75 75
 
... ...
@@ -187,13 +189,6 @@ RUN git clone https://github.com/docker/docker-py.git /docker-py \
187 187
 	&& git checkout -q $DOCKER_PY_COMMIT \
188 188
 	&& pip install -r test-requirements.txt
189 189
 
190
-# Setup s3cmd config
191
-RUN { \
192
-		echo '[default]'; \
193
-		echo 'access_key=$AWS_ACCESS_KEY'; \
194
-		echo 'secret_key=$AWS_SECRET_KEY'; \
195
-	} > ~/.s3cfg
196
-
197 190
 # Set user.email so crosbymichael's in-container merge commits go smoothly
198 191
 RUN git config --global user.email 'docker-dummy@example.com'
199 192
 
... ...
@@ -136,13 +136,6 @@ RUN git clone https://github.com/docker/docker-py.git /docker-py \
136 136
 	&& git checkout -q $DOCKER_PY_COMMIT \
137 137
 	&& pip install -r test-requirements.txt
138 138
 
139
-# Setup s3cmd config
140
-RUN { \
141
-		echo '[default]'; \
142
-		echo 'access_key=$AWS_ACCESS_KEY'; \
143
-		echo 'secret_key=$AWS_SECRET_KEY'; \
144
-	} > ~/.s3cfg
145
-
146 139
 # Set user.email so crosbymichael's in-container merge commits go smoothly
147 140
 RUN git config --global user.email 'docker-dummy@example.com'
148 141
 
... ...
@@ -20,7 +20,7 @@ set -e
20 20
 #   To update this script on https://get.docker.com,
21 21
 #   use hack/release.sh during a normal release,
22 22
 #   or the following one-liner for script hotfixes:
23
-#     s3cmd put --acl-public -P hack/install.sh s3://get.docker.com/index
23
+#     aws s3 cp --acl public-read hack/install.sh s3://get.docker.com/index
24 24
 #
25 25
 
26 26
 url="https://get.docker.com/"
... ...
@@ -9,6 +9,13 @@ if ! command -v docker &> /dev/null; then
9 9
 	false
10 10
 fi
11 11
 
12
+if [ -z "$DOCKER_TEST_HOST" ]; then
13
+	if docker version &> /dev/null; then
14
+		echo >&2 'skipping daemon start, since daemon appears to be already started'
15
+		return
16
+	fi
17
+fi
18
+
12 19
 # intentionally open a couple bogus file descriptors to help test that they get scrubbed in containers
13 20
 exec 41>&1 42>&2
14 21
 
... ...
@@ -14,6 +14,7 @@ set -e
14 14
 #
15 15
 # ... and so on and so forth for the builds created by hack/make/build-deb
16 16
 
17
+source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
17 18
 source "$(dirname "$BASH_SOURCE")/.detect-daemon-osarch"
18 19
 
19 20
 : ${DOCKER_RELEASE_DIR:=$DEST}
... ...
@@ -14,6 +14,7 @@ set -e
14 14
 #
15 15
 # ... and so on and so forth for the builds created by hack/make/build-rpm
16 16
 
17
+source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
17 18
 source "$(dirname "$BASH_SOURCE")/.detect-daemon-osarch"
18 19
 
19 20
 : ${DOCKER_RELEASE_DIR:=$DEST}
... ...
@@ -43,7 +43,7 @@ cd /go/src/github.com/docker/docker
43 43
 [ -x hack/make.sh ] || usage
44 44
 
45 45
 export AWS_DEFAULT_REGION
46
-: ${AWS_DEFAULT_REGION:=us-west-2}
46
+: ${AWS_DEFAULT_REGION:=us-west-1}
47 47
 
48 48
 RELEASE_BUNDLES=(
49 49
 	binary
... ...
@@ -79,8 +79,6 @@ fi
79 79
 
80 80
 setup_s3() {
81 81
 	echo "Setting up S3"
82
-	# TODO: Move to Dockerfile
83
-	pip install awscli==1.10.15
84 82
 	# Try creating the bucket. Ignore errors (it might already exist).
85 83
 	aws s3 mb "s3://$BUCKET" 2>/dev/null || true
86 84
 	# Check access to the bucket.
... ...
@@ -104,8 +102,7 @@ s3_url() {
104 104
 			echo "https://$BUCKET_PATH"
105 105
 			;;
106 106
 		*)
107
-			# TODO: remove s3cmd dependency
108
-			BASE_URL=$( s3cmd ws-info s3://$BUCKET | awk -v 'FS=: +' '/http:\/\/'$BUCKET'/ { gsub(/\/+$/, "", $2); print $2 }' )
107
+			BASE_URL="http://${BUCKET}.s3-website-${AWS_DEFAULT_REGION}.amazonaws.com"
109 108
 			if [[ -n "$AWS_S3_BUCKET_PATH" ]] ; then
110 109
 				echo "$BASE_URL/$AWS_S3_BUCKET_PATH"
111 110
 			else
... ...
@@ -270,8 +270,9 @@ docker build -t docker .
270 270
 # static binaries are still pushed to s3
271 271
 docker run \
272 272
     -e AWS_S3_BUCKET=test.docker.com \
273
-    -e AWS_ACCESS_KEY \
274
-    -e AWS_SECRET_KEY \
273
+    -e AWS_ACCESS_KEY_ID \
274
+    -e AWS_SECRET_ACCESS_KEY \
275
+    -e AWS_DEFAULT_REGION \
275 276
     -i -t --privileged \
276 277
     docker \
277 278
     hack/release.sh
... ...
@@ -434,8 +435,9 @@ docker build -t docker .
434 434
 # static binaries are still pushed to s3
435 435
 docker run \
436 436
     -e AWS_S3_BUCKET=get.docker.com \
437
-    -e AWS_ACCESS_KEY \
438
-    -e AWS_SECRET_KEY \
437
+    -e AWS_ACCESS_KEY_ID \
438
+    -e AWS_SECRET_ACCESS_KEY \
439
+    -e AWS_DEFAULT_REGION \
439 440
     -i -t --privileged \
440 441
     docker \
441 442
     hack/release.sh