2013-09-07 10:30:29 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Variables AWS_ACCESS_KEY, AWS_SECRET_KEY, PG_PASSPHRASE and INDEX_AUTH
|
2013-09-19 16:09:12 -07:00
|
|
|
# are decoded from /root/release_credentials.json
|
2013-09-07 10:30:29 -07:00
|
|
|
# Variable AWS_S3_BUCKET is passed to the environment from docker run -e
|
|
|
|
|
|
|
|
# Enable debugging
|
|
|
|
set -x
|
|
|
|
|
2013-09-19 16:09:12 -07:00
|
|
|
# Fetch docker master branch
|
2013-09-21 12:14:40 -07:00
|
|
|
git clone -q http://github.com/dotcloud/docker /go/src/github.com/dotcloud/docker
|
2013-09-07 10:30:29 -07:00
|
|
|
cd /go/src/github.com/dotcloud/docker
|
|
|
|
|
2013-09-21 12:14:40 -07:00
|
|
|
echo FIXME. Temporarily add Jerome changeset with proper apparmor handling
|
|
|
|
git fetch http://github.com/jpetazzo/docker escape-apparmor-confinement:escape-apparmor-confinement
|
|
|
|
git rebase --onto master master escape-apparmor-confinement
|
|
|
|
|
2013-09-19 16:09:12 -07:00
|
|
|
# Launch docker daemon using dind inside the container
|
|
|
|
./hack/dind /usr/bin/docker -dns=8.8.8.8 -d &
|
|
|
|
sleep 5
|
|
|
|
|
2013-09-07 10:30:29 -07:00
|
|
|
# Add an uncommitted change to generate a timestamped release
|
|
|
|
date > timestamp
|
|
|
|
|
2013-09-19 16:09:12 -07:00
|
|
|
# Build the docker package using /Dockerfile
|
|
|
|
docker build -t docker .
|
2013-09-07 10:30:29 -07:00
|
|
|
|
2013-09-19 16:09:12 -07:00
|
|
|
# Run Docker unittests
|
|
|
|
docker run -privileged docker go test -v || exit 1
|
|
|
|
|
|
|
|
# Create Docker binary and Ubuntu package
|
|
|
|
docker run -privileged docker hack/make.sh binary ubuntu
|
|
|
|
|
|
|
|
# Freeze the container to upload the release
|
|
|
|
docker commit -run '{"Env": ["PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"], "WorkingDir": "/go/src/github.com/dotcloud/docker"}' $(docker ps -l -q) release
|
2013-09-07 10:30:29 -07:00
|
|
|
|
|
|
|
# Turn debug off to load credentials in the environment and
|
|
|
|
# to authenticate to the index
|
|
|
|
set +x
|
|
|
|
eval $(cat /root/release_credentials.json | python -c '
|
|
|
|
import sys,json,base64;
|
|
|
|
d=json.loads(base64.b64decode(sys.stdin.read()));
|
|
|
|
exec("""for k in d: print "export {0}=\\"{1}\\"".format(k,d[k])""")')
|
|
|
|
echo '{"https://index.docker.io/v1/":{"auth":"'$INDEX_AUTH'","email":"engineering@dotcloud.com"}}' > /.dockercfg
|
|
|
|
set -x
|
|
|
|
|
2013-09-19 16:09:12 -07:00
|
|
|
# Extract docker binary
|
|
|
|
docker cp $(docker ps -l -q):/go/src/github.com/dotcloud/docker/bundles /tmp
|
|
|
|
|
|
|
|
# Swap docker production daemon with new docker binary for testing
|
|
|
|
kill $(pgrep '^docker$')
|
|
|
|
sleep 15
|
|
|
|
cp /tmp/bundles/*/binary/* /usr/bin/docker
|
|
|
|
./hack/dind /usr/bin/docker -dns=8.8.8.8 -d &
|
|
|
|
sleep 15
|
|
|
|
|
|
|
|
# Run Docker functional tests
|
2013-09-07 10:30:29 -07:00
|
|
|
# Generate unique image name
|
|
|
|
export DIMAGE=testimage`date +'%Y%m%d%H%M%S'`
|
|
|
|
|
|
|
|
# Simple docker version test
|
|
|
|
docker version || exit 1
|
|
|
|
|
|
|
|
# Containerized hello world
|
|
|
|
docker run -cidfile=hello.cid busybox echo 'Hello world' | grep -q 'Hello world' || exit 1
|
|
|
|
|
|
|
|
# Create an image based on the busybox container and test pushing it to the index
|
|
|
|
docker commit `cat hello.cid` test/$DIMAGE
|
|
|
|
docker images | grep -q test/$DIMAGE || exit 1
|
|
|
|
docker push test/$DIMAGE
|
|
|
|
|
|
|
|
# Verify the image was properly pushed to the index
|
|
|
|
docker search $DIMAGE | grep -q $DIMAGE || exit 1
|
|
|
|
|
|
|
|
# Push docker nightly
|
2013-09-19 16:09:12 -07:00
|
|
|
echo docker run -i -t -privileged -e AWS_S3_BUCKET=$AWS_S3_BUCKET -e AWS_ACCESS_KEY=XXXXX -e AWS_SECRET_KEY=XXXXX -e GPG_PASSPHRASE=XXXXX release hack/release.sh
|
2013-09-07 10:30:29 -07:00
|
|
|
set +x
|
2013-09-19 16:09:12 -07:00
|
|
|
docker run -i -t -privileged -e AWS_S3_BUCKET=$AWS_S3_BUCKET -e AWS_ACCESS_KEY=$AWS_ACCESS_KEY -e AWS_SECRET_KEY=$AWS_SECRET_KEY -e GPG_PASSPHRASE=$GPG_PASSPHRASE release hack/release.sh
|