Bug 1085631 part3: Add phone builder docker image. r=lightsofapollo
authorWander Lairson Costa <wcosta@mozilla.com>
Tue, 16 Dec 2014 12:24:55 -0200
changeset 225743 7bf1779553515286ef693db148f907098e1557fc
parent 225742 d4c985c6f85e5ef0db72e84e34964e31647fe09f
child 225744 7e9b3d5d3c2f8faf00d5d22e5bee83736b2e956b
push id28174
push userryanvm@gmail.com
push dateMon, 26 Jan 2015 21:23:42 +0000
treeherdermozilla-central@c3a90afa2dee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslightsofapollo
bugs1085631
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1085631 part3: Add phone builder docker image. r=lightsofapollo As this image handles files containing partners blobs, it must be private in quay.io, and the builds cannot be made public either. You must use "-i" and "-k" build parameters to handle s3 credentials.
testing/docker/phone-builder/Dockerfile
testing/docker/phone-builder/VERSION
testing/docker/phone-builder/bin/build-phone.sh
testing/docker/phone-builder/build.sh
testing/docker/phone-builder/system-setup.sh
new file mode 100644
--- /dev/null
+++ b/testing/docker/phone-builder/Dockerfile
@@ -0,0 +1,13 @@
+FROM          quay.io/mozilla/builder:0.0.24
+MAINTAINER    Wander Lairson Costa <wcosta@mozilla.com>
+
+# Add utilities and configuration
+ADD           bin                   /home/worker/bin
+ADD           config                /home/worker/.aws/config
+ADD           system-setup.sh       /tmp/system-setup.sh
+
+RUN           /tmp/system-setup.sh
+
+# Set a default command useful for debugging
+CMD ["/bin/bash", "--login"]
+
new file mode 100644
--- /dev/null
+++ b/testing/docker/phone-builder/VERSION
@@ -0,0 +1,1 @@
+0.0.1
new file mode 100755
--- /dev/null
+++ b/testing/docker/phone-builder/bin/build-phone.sh
@@ -0,0 +1,61 @@
+#! /bin/bash -vex
+
+### Check that require variables are defined
+test $REPOSITORY  # Should be an hg repository url to pull from
+test $REVISION    # Should be an hg revision to pull down
+test $TARGET
+
+# First check if the mozharness directory is available. This is intended to be
+# used locally in development to test mozharness changes:
+#
+#   $ docker -v your_mozharness:/home/worker/mozharness ...
+#
+if [ ! -d mozharness ]; then
+  git clone https://github.com/walac/build-mozharness.git mozharness
+fi
+
+OBJDIR="$HOME/object-folder-$TARGET-$B2G_DEBUG"
+
+if [ ! -d $OBJDIR ]; then
+  mkdir -p $OBJDIR
+fi
+
+if [ ! -d $OBJDIR/B2G ]; then
+  git clone https://git.mozilla.org/b2g/B2G.git $OBJDIR/B2G
+fi
+
+debug_flag=""
+if [ 0$B2G_DEBUG -ne 0 ]; then
+  debug_flag='--debug'
+fi
+
+backup_file=$(aws --output=text s3 ls s3://b2g-phone-backups/$TARGET/ | tail -1 | awk '{print $NF}')
+
+if echo $backup_file | grep '\.tar\.bz2'; then
+    aws s3 cp s3://b2g-phone-backups/$TARGET/$backup_file .
+    tar -xjf $backup_file -C $OBJDIR/B2G
+    rm -f $backup_file
+fi
+
+./mozharness/scripts/b2g_build.py \
+  --config b2g/taskcluster-phone.py \
+  "$debug_flag" \
+  --disable-mock \
+  --work-dir=$OBJDIR/B2G \
+  --log-level=debug \
+  --target=$TARGET \
+  --b2g-config-dir=$TARGET \
+  --checkout-revision=$REVISION \
+  --repo=$REPOSITORY
+
+# Don't cache backups
+rm -rf $OBJDIR/B2G/backup-*
+
+# Move files into artifact locations!
+mkdir -p artifacts
+
+mv $OBJDIR/B2G/upload/sources.xml artifacts/sources.xml
+mv $OBJDIR/B2G/upload/b2g-*.crashreporter-symbols.zip artifacts/b2g-crashreporter-symbols.zip
+mv $OBJDIR/B2G/upload/b2g-*.android-arm.tar.gz artifacts/b2g-android-arm.tar.gz
+mv $OBJDIR/B2G/upload/flame-kk.zip artifacts/flame-kk.zip
+mv $OBJDIR/B2G/upload/gaia.zip artifacts/gaia.zip
new file mode 100755
--- /dev/null
+++ b/testing/docker/phone-builder/build.sh
@@ -0,0 +1,30 @@
+#! /bin/bash -e
+
+while getopts "t:i:k:" arg; do
+  case $arg in
+    t)
+      TAG=$OPTARG
+      ;;
+    i)
+      KEY_ID=$OPTARG
+      ;;
+    k)
+      SECRET_KEY=$OPTARG
+      ;;
+  esac
+done
+
+pushd $(dirname $0)
+
+test $TAG
+test $KEY_ID
+test $SECRET_KEY
+
+(echo '[default]'
+echo "aws_access_key_id = $KEY_ID"
+echo "aws_secret_access_key = $SECRET_KEY") > config
+
+docker build -t $TAG .
+rm -f config
+
+popd
new file mode 100755
--- /dev/null
+++ b/testing/docker/phone-builder/system-setup.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+pip install awscli
+
+# Remove ourselves
+rm -f $0