2014-01-22 01:21:56 +00:00
|
|
|
#!/usr/bin/env bash
|
2013-10-17 08:08:14 +00:00
|
|
|
set -e
|
2013-08-07 04:16:13 +00:00
|
|
|
|
2013-08-10 00:38:48 +00:00
|
|
|
# This script looks for bundles built by make.sh, and releases them on a
|
|
|
|
# public S3 bucket.
|
2013-08-07 04:16:13 +00:00
|
|
|
#
|
|
|
|
# Bundles should be available for the VERSION string passed as argument.
|
|
|
|
#
|
2013-08-10 00:38:48 +00:00
|
|
|
# The correct way to call this script is inside a container built by the
|
|
|
|
# official Dockerfile at the root of the Docker source code. The Dockerfile,
|
|
|
|
# make.sh and release.sh should all be from the same source code revision.
|
2013-08-07 04:16:13 +00:00
|
|
|
|
2013-10-17 08:08:14 +00:00
|
|
|
set -o pipefail
|
2013-08-07 04:16:13 +00:00
|
|
|
|
|
|
|
# Print a usage message and exit.
|
|
|
|
usage() {
|
2013-10-17 08:08:14 +00:00
|
|
|
cat >&2 <<'EOF'
|
2013-08-10 01:08:06 +00:00
|
|
|
To run, I need:
|
|
|
|
- to be in a container generated by the Dockerfile at the top of the Docker
|
|
|
|
repository;
|
2015-08-25 19:18:04 +00:00
|
|
|
- to be provided with the location of an S3 bucket and path, in
|
|
|
|
environment variables AWS_S3_BUCKET and AWS_S3_BUCKET_PATH (default: '');
|
2013-08-10 01:08:06 +00:00
|
|
|
- to be provided with AWS credentials for this S3 bucket, in environment
|
|
|
|
variables AWS_ACCESS_KEY and AWS_SECRET_KEY;
|
2013-08-15 00:02:55 +00:00
|
|
|
- the passphrase to unlock the GPG key which will sign the deb packages
|
|
|
|
(passed as environment variable GPG_PASSPHRASE);
|
2013-08-10 01:08:06 +00:00
|
|
|
- a generous amount of good will and nice manners.
|
|
|
|
The canonical way to run me is to run the image produced by the Dockerfile: e.g.:"
|
|
|
|
|
2014-09-23 23:18:09 +00:00
|
|
|
docker run -e AWS_S3_BUCKET=test.docker.com \
|
|
|
|
-e AWS_ACCESS_KEY=... \
|
|
|
|
-e AWS_SECRET_KEY=... \
|
|
|
|
-e GPG_PASSPHRASE=... \
|
2014-03-13 17:46:02 +00:00
|
|
|
-i -t --privileged \
|
2013-10-17 08:08:14 +00:00
|
|
|
docker ./hack/release.sh
|
2013-08-10 01:08:06 +00:00
|
|
|
EOF
|
2013-08-07 04:16:13 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2013-08-10 01:08:06 +00:00
|
|
|
[ "$AWS_S3_BUCKET" ] || usage
|
|
|
|
[ "$AWS_ACCESS_KEY" ] || usage
|
|
|
|
[ "$AWS_SECRET_KEY" ] || usage
|
2013-08-15 00:02:55 +00:00
|
|
|
[ "$GPG_PASSPHRASE" ] || usage
|
2014-07-24 22:19:50 +00:00
|
|
|
[ -d /go/src/github.com/docker/docker ] || usage
|
|
|
|
cd /go/src/github.com/docker/docker
|
2013-10-17 08:08:14 +00:00
|
|
|
[ -x hack/make.sh ] || usage
|
|
|
|
|
|
|
|
RELEASE_BUNDLES=(
|
|
|
|
binary
|
2013-12-19 06:06:14 +00:00
|
|
|
cross
|
2013-11-18 03:25:08 +00:00
|
|
|
tgz
|
2013-10-17 08:08:14 +00:00
|
|
|
ubuntu
|
|
|
|
)
|
|
|
|
|
|
|
|
if [ "$1" != '--release-regardless-of-test-failure' ]; then
|
2014-04-08 04:22:03 +00:00
|
|
|
RELEASE_BUNDLES=(
|
2015-05-12 22:39:57 +00:00
|
|
|
test-unit
|
2014-04-08 04:22:03 +00:00
|
|
|
"${RELEASE_BUNDLES[@]}"
|
|
|
|
test-integration-cli
|
|
|
|
)
|
2013-10-17 08:08:14 +00:00
|
|
|
fi
|
2014-04-08 04:22:03 +00:00
|
|
|
|
2015-04-14 16:31:52 +00:00
|
|
|
VERSION=$(< VERSION)
|
2013-08-10 01:18:33 +00:00
|
|
|
BUCKET=$AWS_S3_BUCKET
|
2015-08-25 19:18:04 +00:00
|
|
|
BUCKET_PATH=$BUCKET
|
|
|
|
[[ -n "$AWS_S3_BUCKET_PATH" ]] && BUCKET_PATH+=/$AWS_S3_BUCKET_PATH
|
2013-08-07 04:16:13 +00:00
|
|
|
|
2014-03-16 21:10:59 +00:00
|
|
|
# These are the 2 keys we've used to sign the deb's
|
2014-09-23 23:18:09 +00:00
|
|
|
# release (get.docker.com)
|
2014-03-16 21:10:59 +00:00
|
|
|
# GPG_KEY="36A1D7869245C8950F966E92D8576A8BA88D21E9"
|
2014-09-23 23:18:09 +00:00
|
|
|
# test (test.docker.com)
|
2014-03-16 21:10:59 +00:00
|
|
|
# GPG_KEY="740B314AE3941731B942C66ADF4FD13717AAD7D6"
|
|
|
|
|
2013-08-07 04:16:13 +00:00
|
|
|
setup_s3() {
|
2015-07-27 21:28:05 +00:00
|
|
|
echo "Setting up S3"
|
2013-08-07 04:16:13 +00:00
|
|
|
# Try creating the bucket. Ignore errors (it might already exist).
|
2015-04-14 16:08:08 +00:00
|
|
|
s3cmd mb "s3://$BUCKET" 2>/dev/null || true
|
2013-08-10 01:18:33 +00:00
|
|
|
# Check access to the bucket.
|
|
|
|
# s3cmd has no useful exit status, so we cannot check that.
|
|
|
|
# Instead, we check if it outputs anything on standard output.
|
|
|
|
# (When there are problems, it uses standard error instead.)
|
2015-04-14 16:08:08 +00:00
|
|
|
s3cmd info "s3://$BUCKET" | grep -q .
|
2013-08-15 01:35:17 +00:00
|
|
|
# Make the bucket accessible through website endpoints.
|
2015-04-14 16:08:08 +00:00
|
|
|
s3cmd ws-create --ws-index index --ws-error error "s3://$BUCKET"
|
2013-08-07 04:16:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# write_to_s3 uploads the contents of standard input to the specified S3 url.
|
|
|
|
write_to_s3() {
|
|
|
|
DEST=$1
|
|
|
|
F=`mktemp`
|
2015-04-14 16:08:08 +00:00
|
|
|
cat > "$F"
|
|
|
|
s3cmd --acl-public --mime-type='text/plain' put "$F" "$DEST"
|
|
|
|
rm -f "$F"
|
2013-08-07 04:16:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
s3_url() {
|
2013-09-28 04:50:24 +00:00
|
|
|
case "$BUCKET" in
|
2015-06-18 21:54:40 +00:00
|
|
|
get.docker.com|test.docker.com|experimental.docker.com)
|
2015-08-25 19:18:04 +00:00
|
|
|
echo "https://$BUCKET_PATH"
|
2013-09-28 04:50:24 +00:00
|
|
|
;;
|
|
|
|
*)
|
2015-08-25 19:18:04 +00:00
|
|
|
BASE_URL=$( s3cmd ws-info s3://$BUCKET | awk -v 'FS=: +' '/http:\/\/'$BUCKET'/ { gsub(/\/+$/, "", $2); print $2 }' )
|
|
|
|
if [[ -n "$AWS_S3_BUCKET_PATH" ]] ; then
|
|
|
|
echo "$BASE_URL/$AWS_S3_BUCKET_PATH"
|
|
|
|
else
|
|
|
|
echo "$BASE_URL"
|
|
|
|
fi
|
2013-09-28 04:50:24 +00:00
|
|
|
;;
|
|
|
|
esac
|
2013-08-07 04:16:13 +00:00
|
|
|
}
|
|
|
|
|
2014-03-16 21:10:59 +00:00
|
|
|
build_all() {
|
2015-07-27 21:28:05 +00:00
|
|
|
echo "Building release"
|
2014-03-16 21:10:59 +00:00
|
|
|
if ! ./hack/make.sh "${RELEASE_BUNDLES[@]}"; then
|
|
|
|
echo >&2
|
|
|
|
echo >&2 'The build or tests appear to have failed.'
|
|
|
|
echo >&2
|
|
|
|
echo >&2 'You, as the release maintainer, now have a couple options:'
|
|
|
|
echo >&2 '- delay release and fix issues'
|
|
|
|
echo >&2 '- delay release and fix issues'
|
|
|
|
echo >&2 '- did we mention how important this is? issues need fixing :)'
|
|
|
|
echo >&2
|
|
|
|
echo >&2 'As a final LAST RESORT, you (because only you, the release maintainer,'
|
|
|
|
echo >&2 ' really knows all the hairy problems at hand with the current release'
|
|
|
|
echo >&2 ' issues) may bypass this checking by running this script again with the'
|
|
|
|
echo >&2 ' single argument of "--release-regardless-of-test-failure", which will skip'
|
|
|
|
echo >&2 ' running the test suite, and will only build the binaries and packages. Please'
|
|
|
|
echo >&2 ' avoid using this if at all possible.'
|
|
|
|
echo >&2
|
|
|
|
echo >&2 'Regardless, we cannot stress enough the scarcity with which this bypass'
|
|
|
|
echo >&2 ' should be used. If there are release issues, we should always err on the'
|
|
|
|
echo >&2 ' side of caution.'
|
|
|
|
echo >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-03-20 01:58:39 +00:00
|
|
|
upload_release_build() {
|
|
|
|
src="$1"
|
|
|
|
dst="$2"
|
|
|
|
latest="$3"
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Uploading $src"
|
|
|
|
echo " to $dst"
|
|
|
|
echo
|
|
|
|
s3cmd --follow-symlinks --preserve --acl-public put "$src" "$dst"
|
|
|
|
if [ "$latest" ]; then
|
|
|
|
echo
|
|
|
|
echo "Copying to $latest"
|
|
|
|
echo
|
|
|
|
s3cmd --acl-public cp "$dst" "$latest"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# get hash files too (see hash_files() in hack/make.sh)
|
|
|
|
for hashAlgo in md5 sha256; do
|
|
|
|
if [ -e "$src.$hashAlgo" ]; then
|
|
|
|
echo
|
|
|
|
echo "Uploading $src.$hashAlgo"
|
|
|
|
echo " to $dst.$hashAlgo"
|
|
|
|
echo
|
|
|
|
s3cmd --follow-symlinks --preserve --acl-public --mime-type='text/plain' put "$src.$hashAlgo" "$dst.$hashAlgo"
|
|
|
|
if [ "$latest" ]; then
|
|
|
|
echo
|
|
|
|
echo "Copying to $latest.$hashAlgo"
|
|
|
|
echo
|
|
|
|
s3cmd --acl-public cp "$dst.$hashAlgo" "$latest.$hashAlgo"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2013-12-24 06:31:53 +00:00
|
|
|
release_build() {
|
2015-07-27 21:28:05 +00:00
|
|
|
echo "Releasing binaries"
|
2013-12-24 06:31:53 +00:00
|
|
|
GOOS=$1
|
|
|
|
GOARCH=$2
|
|
|
|
|
2014-03-20 01:58:39 +00:00
|
|
|
binDir=bundles/$VERSION/cross/$GOOS/$GOARCH
|
|
|
|
tgzDir=bundles/$VERSION/tgz/$GOOS/$GOARCH
|
|
|
|
binary=docker-$VERSION
|
|
|
|
tgz=docker-$VERSION.tgz
|
|
|
|
|
|
|
|
latestBase=
|
|
|
|
if [ -z "$NOLATEST" ]; then
|
|
|
|
latestBase=docker-latest
|
|
|
|
fi
|
2013-12-24 06:31:53 +00:00
|
|
|
|
|
|
|
# we need to map our GOOS and GOARCH to uname values
|
|
|
|
# see https://en.wikipedia.org/wiki/Uname
|
|
|
|
# ie, GOOS=linux -> "uname -s"=Linux
|
|
|
|
|
2014-03-20 01:58:39 +00:00
|
|
|
s3Os=$GOOS
|
|
|
|
case "$s3Os" in
|
2013-12-24 06:31:53 +00:00
|
|
|
darwin)
|
2014-03-20 01:58:39 +00:00
|
|
|
s3Os=Darwin
|
2013-12-24 06:31:53 +00:00
|
|
|
;;
|
|
|
|
freebsd)
|
2014-03-20 01:58:39 +00:00
|
|
|
s3Os=FreeBSD
|
2013-12-24 06:31:53 +00:00
|
|
|
;;
|
|
|
|
linux)
|
2014-03-20 01:58:39 +00:00
|
|
|
s3Os=Linux
|
2013-12-24 06:31:53 +00:00
|
|
|
;;
|
2015-03-11 18:29:29 +00:00
|
|
|
windows)
|
|
|
|
s3Os=Windows
|
|
|
|
binary+='.exe'
|
|
|
|
if [ "$latestBase" ]; then
|
|
|
|
latestBase+='.exe'
|
|
|
|
fi
|
|
|
|
;;
|
2013-12-24 06:31:53 +00:00
|
|
|
*)
|
2014-03-20 01:58:39 +00:00
|
|
|
echo >&2 "error: can't convert $s3Os to an appropriate value for 'uname -s'"
|
2013-12-24 06:31:53 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2014-03-20 01:58:39 +00:00
|
|
|
s3Arch=$GOARCH
|
|
|
|
case "$s3Arch" in
|
2013-12-24 06:31:53 +00:00
|
|
|
amd64)
|
2014-03-20 01:58:39 +00:00
|
|
|
s3Arch=x86_64
|
2013-12-24 06:31:53 +00:00
|
|
|
;;
|
|
|
|
386)
|
2014-03-20 01:58:39 +00:00
|
|
|
s3Arch=i386
|
2013-12-24 06:31:53 +00:00
|
|
|
;;
|
|
|
|
arm)
|
2014-03-20 01:58:39 +00:00
|
|
|
s3Arch=armel
|
2014-01-31 10:16:42 +00:00
|
|
|
# someday, we might potentially support mutliple GOARM values, in which case we might get armhf here too
|
2013-12-24 06:31:53 +00:00
|
|
|
;;
|
|
|
|
*)
|
2014-03-20 01:58:39 +00:00
|
|
|
echo >&2 "error: can't convert $s3Arch to an appropriate value for 'uname -m'"
|
2013-12-24 06:31:53 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2015-08-25 19:18:04 +00:00
|
|
|
s3Dir="s3://$BUCKET_PATH/builds/$s3Os/$s3Arch"
|
2014-03-20 01:58:39 +00:00
|
|
|
latest=
|
|
|
|
latestTgz=
|
|
|
|
if [ "$latestBase" ]; then
|
|
|
|
latest="$s3Dir/$latestBase"
|
|
|
|
latestTgz="$s3Dir/$latestBase.tgz"
|
|
|
|
fi
|
2013-12-24 06:31:53 +00:00
|
|
|
|
2014-03-20 01:58:39 +00:00
|
|
|
if [ ! -x "$binDir/$binary" ]; then
|
|
|
|
echo >&2 "error: can't find $binDir/$binary - was it compiled properly?"
|
2013-12-24 06:31:53 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2014-03-20 01:58:39 +00:00
|
|
|
if [ ! -f "$tgzDir/$tgz" ]; then
|
|
|
|
echo >&2 "error: can't find $tgzDir/$tgz - was it packaged properly?"
|
2013-12-24 06:31:53 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-03-20 01:58:39 +00:00
|
|
|
upload_release_build "$binDir/$binary" "$s3Dir/$binary" "$latest"
|
|
|
|
upload_release_build "$tgzDir/$tgz" "$s3Dir/$tgz" "$latestTgz"
|
2013-12-24 06:31:53 +00:00
|
|
|
}
|
|
|
|
|
2013-08-07 04:16:13 +00:00
|
|
|
# Upload the 'ubuntu' bundle to S3:
|
|
|
|
# 1. A full APT repository is published at $BUCKET/ubuntu/
|
2013-11-08 22:45:18 +00:00
|
|
|
# 2. Instructions for using the APT repository are uploaded at $BUCKET/ubuntu/index
|
2013-08-07 04:16:13 +00:00
|
|
|
release_ubuntu() {
|
2015-07-27 21:28:05 +00:00
|
|
|
echo "Releasing ubuntu"
|
2015-04-14 16:08:08 +00:00
|
|
|
[ -e "bundles/$VERSION/ubuntu" ] || {
|
2013-10-17 08:08:14 +00:00
|
|
|
echo >&2 './hack/make.sh must be run before release_ubuntu'
|
|
|
|
exit 1
|
|
|
|
}
|
2013-08-15 00:02:55 +00:00
|
|
|
|
2015-06-04 22:51:12 +00:00
|
|
|
local debfiles=( "bundles/$VERSION/ubuntu/"*.deb )
|
|
|
|
|
2013-08-15 00:02:55 +00:00
|
|
|
# Sign our packages
|
2015-06-04 22:51:12 +00:00
|
|
|
dpkg-sig -g "--passphrase $GPG_PASSPHRASE" -k releasedocker --sign builder "${debfiles[@]}"
|
2013-08-15 00:02:55 +00:00
|
|
|
|
2013-08-13 03:16:55 +00:00
|
|
|
# Setup the APT repo
|
|
|
|
APTDIR=bundles/$VERSION/ubuntu/apt
|
2015-04-14 16:08:08 +00:00
|
|
|
mkdir -p "$APTDIR/conf" "$APTDIR/db"
|
|
|
|
s3cmd sync "s3://$BUCKET/ubuntu/db/" "$APTDIR/db/" || true
|
|
|
|
cat > "$APTDIR/conf/distributions" <<EOF
|
2013-08-13 03:16:55 +00:00
|
|
|
Codename: docker
|
|
|
|
Components: main
|
2013-08-14 17:41:23 +00:00
|
|
|
Architectures: amd64 i386
|
2013-08-13 03:16:55 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# Add the DEB package to the APT repo
|
2015-06-04 22:51:12 +00:00
|
|
|
reprepro -b "$APTDIR" includedeb docker "${debfiles[@]}"
|
2013-08-13 03:16:55 +00:00
|
|
|
|
2013-08-15 00:02:55 +00:00
|
|
|
# Sign
|
2013-10-17 08:08:14 +00:00
|
|
|
for F in $(find $APTDIR -name Release); do
|
2015-04-14 16:08:08 +00:00
|
|
|
gpg -u releasedocker --passphrase "$GPG_PASSPHRASE" \
|
2013-08-15 00:02:55 +00:00
|
|
|
--armor --sign --detach-sign \
|
2015-04-14 16:08:08 +00:00
|
|
|
--output "$F.gpg" "$F"
|
2013-08-15 00:02:55 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# Upload keys
|
2015-04-14 16:08:08 +00:00
|
|
|
s3cmd sync "$HOME/.gnupg/" "s3://$BUCKET/ubuntu/.gnupg/"
|
|
|
|
gpg --armor --export releasedocker > "bundles/$VERSION/ubuntu/gpg"
|
|
|
|
s3cmd --acl-public put "bundles/$VERSION/ubuntu/gpg" "s3://$BUCKET/gpg"
|
2013-08-15 00:02:55 +00:00
|
|
|
|
2014-09-11 20:49:43 +00:00
|
|
|
local gpgFingerprint=36A1D7869245C8950F966E92D8576A8BA88D21E9
|
2015-06-20 17:16:28 +00:00
|
|
|
local s3Headers=
|
2014-09-11 20:49:43 +00:00
|
|
|
if [[ $BUCKET == test* ]]; then
|
|
|
|
gpgFingerprint=740B314AE3941731B942C66ADF4FD13717AAD7D6
|
2015-06-16 01:38:06 +00:00
|
|
|
elif [[ $BUCKET == experimental* ]]; then
|
|
|
|
gpgFingerprint=E33FF7BF5C91D50A6F91FFFD4CC38D40F9A96B49
|
2015-06-20 17:16:28 +00:00
|
|
|
s3Headers='--add-header=Cache-Control:no-cache'
|
2014-09-11 20:49:43 +00:00
|
|
|
fi
|
|
|
|
|
2013-08-15 00:02:55 +00:00
|
|
|
# Upload repo
|
2015-06-20 17:16:28 +00:00
|
|
|
s3cmd --acl-public "$s3Headers" sync "$APTDIR/" "s3://$BUCKET/ubuntu/"
|
2013-11-08 22:45:18 +00:00
|
|
|
cat <<EOF | write_to_s3 s3://$BUCKET/ubuntu/index
|
2015-07-23 21:13:22 +00:00
|
|
|
echo "# WARNING! This script is deprecated. Please use the script"
|
|
|
|
echo "# at https://get.docker.com/"
|
2013-08-07 04:16:13 +00:00
|
|
|
EOF
|
2013-11-08 22:45:18 +00:00
|
|
|
|
|
|
|
# Add redirect at /ubuntu/info for URL-backwards-compatibility
|
|
|
|
rm -rf /tmp/emptyfile && touch /tmp/emptyfile
|
2015-04-14 16:08:08 +00:00
|
|
|
s3cmd --acl-public --add-header='x-amz-website-redirect-location:/ubuntu/' --mime-type='text/plain' put /tmp/emptyfile "s3://$BUCKET/ubuntu/info"
|
2013-11-08 22:45:18 +00:00
|
|
|
|
|
|
|
echo "APT repository uploaded. Instructions available at $(s3_url)/ubuntu"
|
2013-08-07 04:16:13 +00:00
|
|
|
}
|
|
|
|
|
2013-12-24 06:31:53 +00:00
|
|
|
# Upload binaries and tgz files to S3
|
|
|
|
release_binaries() {
|
2015-04-14 16:08:08 +00:00
|
|
|
[ -e "bundles/$VERSION/cross/linux/amd64/docker-$VERSION" ] || {
|
2013-12-24 06:31:53 +00:00
|
|
|
echo >&2 './hack/make.sh must be run before release_binaries'
|
2013-11-18 03:25:08 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2013-12-24 06:31:53 +00:00
|
|
|
for d in bundles/$VERSION/cross/*/*; do
|
|
|
|
GOARCH="$(basename "$d")"
|
|
|
|
GOOS="$(basename "$(dirname "$d")")"
|
|
|
|
release_build "$GOOS" "$GOARCH"
|
|
|
|
done
|
2013-11-18 03:25:08 +00:00
|
|
|
|
2013-12-24 06:31:53 +00:00
|
|
|
# TODO create redirect from builds/*/i686 to builds/*/i386
|
2013-11-08 22:45:18 +00:00
|
|
|
|
2015-08-25 19:18:04 +00:00
|
|
|
cat <<EOF | write_to_s3 s3://$BUCKET_PATH/builds/index
|
2013-08-07 04:16:13 +00:00
|
|
|
# To install, run the following command as root:
|
2014-07-07 16:35:38 +00:00
|
|
|
curl -sSL -O $(s3_url)/builds/Linux/x86_64/docker-$VERSION && chmod +x docker-$VERSION && sudo mv docker-$VERSION /usr/local/bin/docker
|
2013-08-07 04:16:13 +00:00
|
|
|
# Then start docker in daemon mode:
|
2015-08-10 12:48:08 +00:00
|
|
|
sudo /usr/local/bin/docker daemon
|
2013-08-07 04:16:13 +00:00
|
|
|
EOF
|
2013-11-08 22:45:18 +00:00
|
|
|
|
|
|
|
# Add redirect at /builds/info for URL-backwards-compatibility
|
|
|
|
rm -rf /tmp/emptyfile && touch /tmp/emptyfile
|
2015-08-25 19:18:04 +00:00
|
|
|
s3cmd --acl-public --add-header='x-amz-website-redirect-location:/builds/' --mime-type='text/plain' put /tmp/emptyfile "s3://$BUCKET_PATH/builds/info"
|
2013-11-08 22:45:18 +00:00
|
|
|
|
2013-08-07 04:16:13 +00:00
|
|
|
if [ -z "$NOLATEST" ]; then
|
2015-08-25 19:18:04 +00:00
|
|
|
echo "Advertising $VERSION on $BUCKET_PATH as most recent version"
|
|
|
|
echo "$VERSION" | write_to_s3 "s3://$BUCKET_PATH/latest"
|
2013-08-07 04:16:13 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-08-15 01:35:17 +00:00
|
|
|
# Upload the index script
|
|
|
|
release_index() {
|
2015-07-27 21:28:05 +00:00
|
|
|
echo "Releasing index"
|
2015-08-25 19:18:04 +00:00
|
|
|
sed "s,url='https://get.docker.com/',url='$(s3_url)/'," hack/install.sh | write_to_s3 "s3://$BUCKET_PATH/index"
|
2013-08-15 01:35:17 +00:00
|
|
|
}
|
|
|
|
|
2013-09-09 23:30:24 +00:00
|
|
|
release_test() {
|
2015-07-27 21:28:05 +00:00
|
|
|
echo "Releasing tests"
|
2013-09-09 23:30:24 +00:00
|
|
|
if [ -e "bundles/$VERSION/test" ]; then
|
2015-08-25 19:18:04 +00:00
|
|
|
s3cmd --acl-public sync "bundles/$VERSION/test/" "s3://$BUCKET_PATH/test/"
|
2013-09-09 23:30:24 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-03-16 21:10:59 +00:00
|
|
|
setup_gpg() {
|
2015-07-27 21:28:05 +00:00
|
|
|
echo "Setting up GPG"
|
2014-03-16 21:10:59 +00:00
|
|
|
# Make sure that we have our keys
|
2015-04-14 16:08:08 +00:00
|
|
|
mkdir -p "$HOME/.gnupg/"
|
|
|
|
s3cmd sync "s3://$BUCKET/ubuntu/.gnupg/" "$HOME/.gnupg/" || true
|
2014-03-16 21:10:59 +00:00
|
|
|
gpg --list-keys releasedocker >/dev/null || {
|
|
|
|
gpg --gen-key --batch <<EOF
|
|
|
|
Key-Type: RSA
|
2014-03-20 01:58:39 +00:00
|
|
|
Key-Length: 4096
|
2014-03-16 21:10:59 +00:00
|
|
|
Passphrase: $GPG_PASSPHRASE
|
|
|
|
Name-Real: Docker Release Tool
|
2014-07-24 22:19:50 +00:00
|
|
|
Name-Email: docker@docker.com
|
2014-03-16 21:10:59 +00:00
|
|
|
Name-Comment: releasedocker
|
|
|
|
Expire-Date: 0
|
|
|
|
%commit
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-07 04:16:13 +00:00
|
|
|
main() {
|
2014-03-16 21:10:59 +00:00
|
|
|
build_all
|
2013-08-07 04:16:13 +00:00
|
|
|
setup_s3
|
2014-03-16 21:10:59 +00:00
|
|
|
setup_gpg
|
2013-12-24 06:31:53 +00:00
|
|
|
release_binaries
|
2013-08-07 04:16:13 +00:00
|
|
|
release_ubuntu
|
2013-08-15 01:35:17 +00:00
|
|
|
release_index
|
2013-09-09 23:30:24 +00:00
|
|
|
release_test
|
2013-08-07 04:16:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|
2013-12-24 06:31:53 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo "Release complete; see $(s3_url)"
|
2015-07-09 17:58:27 +00:00
|
|
|
echo "Use the following text to announce the release:"
|
|
|
|
echo
|
|
|
|
echo "We have just pushed $VERSION to $(s3_url). You can download it with the following:"
|
|
|
|
echo
|
|
|
|
echo "Ubuntu/Debian: curl -sSL $(s3_url) | sh"
|
|
|
|
echo "Linux 64bit binary: $(s3_url)/builds/Linux/x86_64/docker-$VERSION"
|
|
|
|
echo "Darwin/OSX 64bit client binary: $(s3_url)/builds/Darwin/x86_64/docker-$VERSION"
|
|
|
|
echo "Darwin/OSX 32bit client binary: $(s3_url)/builds/Darwin/i386/docker-$VERSION"
|
|
|
|
echo "Linux 64bit tgz: $(s3_url)/builds/Linux/x86_64/docker-$VERSION.tgz"
|
|
|
|
echo "Windows 64bit client binary: $(s3_url)/builds/Windows/x86_64/docker-$VERSION.exe"
|
|
|
|
echo "Windows 32bit client binary: $(s3_url)/builds/Windows/i386/docker-$VERSION.exe"
|
2013-12-24 06:31:53 +00:00
|
|
|
echo
|