-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testing, issue moby#1766: Upgrade tooling for Docker nightly release
- Loading branch information
Showing
8 changed files
with
73 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,18 +52,5 @@ nighthly release | |
================ | ||
|
||
The nightly release process is done by buildbot, running a DinD container that downloads | ||
the docker repository and builds the release container. The resulting | ||
docker binary is then tested, and if everything is fine the release is done. | ||
|
||
Building the release DinD Container | ||
----------------------------------- | ||
|
||
# Log into docker-ci | ||
ssh [email protected] | ||
cd /data/docker/testing/nightlyrelease | ||
# Add release_credentials.json as specified in ./Dockerfile | ||
cat > release_credentials.json << EOF | ||
EOF | ||
sudo docker build -t dockerbuilder . | ||
# Now that the container is built release_credentials.json is not needed anymore | ||
git checkout release_credentials.json | ||
the docker repository and builds the release container. The resulting docker | ||
binary is then tested, and if everything is fine, the release is done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh -e | ||
# This is a one time script to prepare docker-ci | ||
|
||
# Build docker nightly release container | ||
cd /go/src/github.com/dotcloud/docker/testing/nightlyrelease; docker build -t dockerbuilder . | ||
|
||
# Relaunch docker for dind to work (disabling apparmor) | ||
/sbin/stop docker | ||
DIND_CMD=" /etc/init.d/apparmor stop; /etc/init.d/apparmor teardown; /usr/bin/docker -dns=8.8.8.8 -d" | ||
sed -Ei "s~ /usr/bin/docker -d~$DIND_CMD~" /etc/init/docker.conf | ||
/sbin/start docker | ||
|
||
# Self removing | ||
echo -e '#!/bin/sh -e\nexit 0\n' > /etc/rc.local | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# VERSION: 1.0 | ||
# DOCKER-VERSION 0.6.1 | ||
# VERSION: 1.1 | ||
# DOCKER-VERSION 0.6.2 | ||
# AUTHOR: Daniel Mizyrycki <[email protected]> | ||
# DESCRIPTION: Build docker nightly release using Docker in Docker. | ||
# REFERENCES: This code reuses the excellent implementation of docker in docker | ||
|
@@ -10,26 +10,18 @@ | |
# "AWS_SECRET_KEY='Test_docker_AWS_S3_bucket_key' | ||
# "GPG_PASSPHRASE='Test_docker_GPG_passphrase_signature' | ||
# "INDEX_AUTH='Encripted_index_authentication' } | ||
# When releasing: Docker in Docker requires cgroups mounted the same way in | ||
# the host and containers: | ||
# stop docker | ||
# umount /sys/fs/cgroup/*; umount /sys/fs/cgroup; mount -t tmpfs none /sys/fs/cgroup | ||
# cd /sys/fs/cgroup; for C in $(awk '{print $1}' < /proc/cgroups | grep -v subsys | grep -v memory) ; do mkdir $C ; mount -t cgroup none -o $C $C ; done | ||
# docker -d & | ||
# TO_BUILD: docker build -t dockerbuilder . | ||
# TO_RELEASE: docker run -i -t -privileged -lxc-conf="lxc.aa_profile = unconfined" -e AWS_S3_BUCKET="test.docker.io" dockerbuilder | ||
|
||
from ubuntu:12.04 | ||
maintainer Daniel Mizyrycki <[email protected]> | ||
|
||
# Add docker dependencies | ||
# Add docker dependencies and downloading packages | ||
run echo 'deb http://archive.ubuntu.com/ubuntu precise main universe' > /etc/apt/sources.list | ||
run apt-get update; apt-get install -y -q iptables ca-certificates bzip2 python lxc curl git mercurial | ||
run curl -s https://go.googlecode.com/files/go1.1.2.linux-amd64.tar.gz | tar -v -C /usr/local -xz | ||
run ln -s /usr/local/go/bin/go /usr/bin | ||
run apt-get update; apt-get install -y -q lxc bzip2 iptables ca-certificates git wget python2.7 | ||
|
||
# Add production docker binary | ||
run curl http://get.docker.io/builds/Linux/x86_64/docker-latest >/usr/bin/docker; chmod +x /usr/bin/docker | ||
run wget -O /usr/bin/docker http://get.docker.io/builds/Linux/x86_64/docker-latest; chmod +x /usr/bin/docker | ||
|
||
# Add proto docker builder | ||
add ./dockerbuild /usr/bin/dockerbuild | ||
|
@@ -38,9 +30,8 @@ run chmod +x /usr/bin/dockerbuild | |
# Add release credentials | ||
add ./release_credentials.json /root/release_credentials.json | ||
|
||
# Make /tmp and /var/lib/docker inside the container addressable by other containers. | ||
# This is done to ensure /tmp and /var/lib/docker has AUFS support needed by the inner docker server | ||
volume /tmp | ||
# Make /var/lib/docker inside the container addressable by other containers. | ||
# This is done to ensure /var/lib/docker has AUFS support needed by the inner docker server | ||
volume /var/lib/docker | ||
|
||
# Launch build process in a container | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# Variables AWS_ACCESS_KEY, AWS_SECRET_KEY, PG_PASSPHRASE and INDEX_AUTH | ||
# are decoded from /root/release_credentials.json and passed to the environment | ||
# are decoded from /root/release_credentials.json | ||
# Variable AWS_S3_BUCKET is passed to the environment from docker run -e | ||
|
||
# Enable debugging | ||
set -x | ||
|
||
# Prepare container environment to run docker in docker | ||
# Mount cgroups | ||
mount -t tmpfs none /tmp; mount -t tmpfs none /sys/fs/cgroup; cd /sys/fs/cgroup | ||
for C in $(awk "{print \$1}" < /proc/cgroups | grep -v subsys | grep -v memory) ; do mkdir $C ; mount -t cgroup none -o $C $C ; done | ||
pushd /proc/self/fd >/dev/null; for FD in *; do case "$FD" in [012]) ;; *) eval exec "$FD>&-" ;; esac done; popd >/dev/null | ||
|
||
# Launch docker daemon inside the container | ||
docker -d & | ||
|
||
# fetch docker master branch | ||
export GOPATH=/go | ||
rm -rf $GOPATH; mkdir -p $GOPATH | ||
go get -d github.com/dotcloud/docker | ||
# Fetch docker master branch | ||
git clone http://github.com/dotcloud/docker /go/src/github.com/dotcloud/docker | ||
cd /go/src/github.com/dotcloud/docker | ||
|
||
# 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 and extract docker binary | ||
docker build -t releasedocker . | ||
docker run releasedocker sh -c 'cat /go/src/github.com/dotcloud/docker/bundles/*/binary/docker*' >/docker | ||
chmod +x /docker | ||
# Build the docker package using /Dockerfile | ||
docker build -t docker . | ||
|
||
# Swap docker production daemon with new docker binary for testing | ||
kill $(pgrep '^docker$') | ||
sleep 15 | ||
mv /docker /usr/bin | ||
docker -d & | ||
sleep 15 | ||
# 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 | ||
|
@@ -47,7 +40,17 @@ exec("""for k in d: print "export {0}=\\"{1}\\"".format(k,d[k])""")') | |
echo '{"https://index.docker.io/v1/":{"auth":"'$INDEX_AUTH'","email":"[email protected]"}}' > /.dockercfg | ||
set -x | ||
|
||
# Test docker nightly | ||
# 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'` | ||
|
||
|
@@ -66,6 +69,6 @@ docker push test/$DIMAGE | |
docker search $DIMAGE | grep -q $DIMAGE || exit 1 | ||
|
||
# Push docker nightly | ||
echo docker run -i -t -e AWS_S3_BUCKET="$AWS_S3_BUCKET" -e AWS_ACCESS_KEY="XXXXX" -e AWS_SECRET_KEY="XXXXX" -e GPG_PASSPHRASE="XXXXX" releasedocker | ||
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 -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" releasedocker | ||
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 |