1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/testing/nightlyrelease/dockerbuild

79 lines
2.9 KiB
Text
Raw Normal View History

#!/bin/bash
# Variables AWS_ACCESS_KEY, AWS_SECRET_KEY, PG_PASSPHRASE and INDEX_AUTH
# are decoded from /root/release_credentials.json
# Variable AWS_S3_BUCKET is passed to the environment from docker run -e
# Enable debugging
set -x
# Fetch docker master branch
git clone -q http://github.com/dotcloud/docker /go/src/github.com/dotcloud/docker
cd /go/src/github.com/dotcloud/docker
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
# Launch docker daemon using dind inside the container
./hack/dind /usr/bin/docker -dns=8.8.8.8 -d &
sleep 5
# Add an uncommitted change to generate a timestamped release
date > timestamp
# Build the docker package using /Dockerfile
docker build -t docker .
# 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
# 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
# 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
# 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
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
set +x
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