From 28606dd37031d758d72cf60c89f2396053a0d650 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Tue, 6 Aug 2013 21:16:13 -0700 Subject: [PATCH] release.sh: publish a full release of docker to a S3 bucket, including static binary and a full APT repository with install instructions Upstream-commit: ccc3969536f875719fca446fa5ad8f69557dbe84 Component: engine --- components/engine/release.sh | 81 ++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 components/engine/release.sh diff --git a/components/engine/release.sh b/components/engine/release.sh new file mode 100755 index 0000000000..e9acc2a1e1 --- /dev/null +++ b/components/engine/release.sh @@ -0,0 +1,81 @@ +#!/bin/sh + +# This script looks for bundles built by make.sh, and releases them on a public S3 bucket. +# +# Bundles should be available for the VERSION string passed as argument. +# +# 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. + +set -x +set -e + +# Print a usage message and exit. +usage() { + echo "Usage: $0 VERSION BUCKET" + echo "For example: $0 0.5.1-dev sandbox.get.docker.io" + exit 1 +} + +VERSION=$1 +BUCKET=$2 +[ -z "$VERSION" ] && usage +[ -z "$BUCKET" ] && usage + +setup_s3() { + # Try creating the bucket. Ignore errors (it might already exist). + s3cmd --acl-public mb $BUCKET 2>/dev/null || true +} + +# write_to_s3 uploads the contents of standard input to the specified S3 url. +write_to_s3() { + DEST=$1 + F=`mktemp` + cat > $F + s3cmd --acl-public put $F $DEST + rm -f $F +} + +s3_url() { + echo "http://$BUCKET.s3.amazonaws.com" +} + +# Upload the 'ubuntu' bundle to S3: +# 1. A full APT repository is published at $BUCKET/ubuntu/ +# 2. Instructions for using the APT repository are uploaded at $BUCKET/ubuntu/info +release_ubuntu() { + s3cmd --acl-public --verbose --delete-removed --follow-symlinks sync bundles/$VERSION/ubuntu/apt/ s3://$BUCKET/ubuntu/ + cat <