From a0478f726d8751f37e4e20e3cc5e858bfc111180 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Tue, 23 Apr 2013 22:57:34 -0700 Subject: [PATCH] dockerbuilder: upload most recent Ubuntu package (note version FOO might not yet be packaged at tag vFOO) --- hack/dockerbuilder/Dockerfile | 14 ++++++--- hack/dockerbuilder/dockerbuilder | 54 ++++++++++++++++++++++++-------- 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/hack/dockerbuilder/Dockerfile b/hack/dockerbuilder/Dockerfile index 8ef1e40b9d..bf5a25de90 100644 --- a/hack/dockerbuilder/Dockerfile +++ b/hack/dockerbuilder/Dockerfile @@ -2,10 +2,16 @@ # uploading it to S3 from ubuntu:12.10 run apt-get update -run RUNLEVEL=1 DEBIAN_FRONTEND=noninteractive apt-get install -y -q s3cmd -run RUNLEVEL=1 DEBIAN_FRONTEND=noninteractive apt-get install -y -q golang -run RUNLEVEL=1 DEBIAN_FRONTEND=noninteractive apt-get install -y -q git -run RUNLEVEL=1 DEBIAN_FRONTEND=noninteractive apt-get install -y -q build-essential +run DEBIAN_FRONTEND=noninteractive apt-get install -y -q s3cmd +# Packages required to checkout and build docker +run DEBIAN_FRONTEND=noninteractive apt-get install -y -q golang +run DEBIAN_FRONTEND=noninteractive apt-get install -y -q git +run DEBIAN_FRONTEND=noninteractive apt-get install -y -q build-essential +# Packages required to build an ubuntu package +run DEBIAN_FRONTEND=noninteractive apt-get install -y -q debhelper +run DEBIAN_FRONTEND=noninteractive apt-get install -y -q autotools-dev +copy fake_initctl /usr/local/bin/initctl +run DEBIAN_FRONTEND=noninteractive apt-get install -y -q devscripts copy dockerbuilder /usr/local/bin/dockerbuilder copy s3cfg /.s3cfg # run $img dockerbuilder $REVISION_OR_TAG $S3_ID $S3_KEY diff --git a/hack/dockerbuilder/dockerbuilder b/hack/dockerbuilder/dockerbuilder index de9f94f9f5..faec3be08d 100644 --- a/hack/dockerbuilder/dockerbuilder +++ b/hack/dockerbuilder/dockerbuilder @@ -4,22 +4,50 @@ set -e PACKAGE=github.com/dotcloud/docker -if [ $# -lt 3 ]; then - echo "Usage: $0 REVISION AWS_ID AWS_KEY" +if [ $# -gt 1 ]; then + echo "Usage: $0 [REVISION]" exit 1 fi -export REVISION=$1 AWS_ID=$2 AWS_KEY=$3 +export REVISION=$1 -START=$(pwd) -git clone "https://$PACKAGE" docker-checkout-$REVISION -cd docker-checkout-$REVISION -git checkout $REVISION +if [ -z "$AWS_ID" ]; then + echo "Warning: environment variable AWS_ID is not set. Won't upload to S3." + NO_S3=1 +fi -make -BUILDDIR=${START}/docker-$REVISION -cp -R ./bin $BUILDDIR +if [ -z "$AWS_KEY" ]; then + echo "Warning: environment variable AWS_KEY is not set. Won't upload to S3." + NO_S3=1 +fi -BUILD_ARCHIVE=${START}/docker-$REVISION.tgz -tar -f $BUILD_ARCHIVE -C $(dirname $BUILDDIR) -zc $(basename $BUILDDIR) -s3cmd -P put $BUILD_ARCHIVE s3://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-$REVISION.tgz +if [ -z "$GPG_KEY" ]; then + echo "Warning: environment variable GPG_KEY is not set. Ubuntu package upload will not succeed." + NO_UBUNTU=1 +fi + +if [ -z "$REVISION" ]; then + rm -fr docker-master + git clone https://github.com/dotcloud/docker docker-master + cd docker-master +else + rm -fr docker-$REVISION + git init docker-$REVISION + cd docker-$REVISION + git fetch -t https://github.com/dotcloud/docker $REVISION + git reset --hard FETCH_HEAD +fi + +if [ -z "$REVISION" ]; then + make release +else + make release RELEASE_VERSION=$REVISION +fi + +if [ -z "$NO_S3" ]; then + s3cmd -P put docker-$REVISION.tgz s3://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-$REVISION.tgz +fi + +if [ -z "$NO_UBUNTU" ]; then + (cd packaging/ubuntu && make ubuntu) +fi