diff options
Diffstat (limited to 'testing/docker/desktop-build')
-rw-r--r-- | testing/docker/desktop-build/Dockerfile | 65 | ||||
-rw-r--r-- | testing/docker/desktop-build/bin/build.sh | 36 | ||||
-rw-r--r-- | testing/docker/desktop-build/bin/checkout-script.sh | 17 | ||||
-rw-r--r-- | testing/docker/desktop-build/bin/checkout-sources.sh | 55 | ||||
-rw-r--r-- | testing/docker/desktop-build/buildprops.json | 9 | ||||
-rw-r--r-- | testing/docker/desktop-build/dot-config/pip/pip.conf | 2 | ||||
-rw-r--r-- | testing/docker/desktop-build/oauth.txt | 2 |
7 files changed, 186 insertions, 0 deletions
diff --git a/testing/docker/desktop-build/Dockerfile b/testing/docker/desktop-build/Dockerfile new file mode 100644 index 000000000..4ccb4c985 --- /dev/null +++ b/testing/docker/desktop-build/Dockerfile @@ -0,0 +1,65 @@ +# TODO remove VOLUME below when the base image is updated next. +FROM taskcluster/centos6-build-upd:0.1.6.20160329195300 +MAINTAINER Dustin J. Mitchell <dustin@mozilla.com> + +# TODO remove when base image is updated +VOLUME /home/worker/workspace +VOLUME /home/worker/tooltool-cache + +# Add build scripts; these are the entry points from the taskcluster worker, and +# operate on environment variables +ADD bin /home/worker/bin +RUN chmod +x /home/worker/bin/* + +# %include testing/docker/recipes/tooltool.py +ADD topsrcdir/testing/docker/recipes/tooltool.py /builds/tooltool.py +ADD topsrcdir/testing/docker/recipes/tooltool.py /setup/tooltool.py + +# %include testing/mozharness/external_tools/robustcheckout.py +ADD topsrcdir/testing/mozharness/external_tools/robustcheckout.py /usr/local/mercurial/robustcheckout.py + +# %include testing/docker/recipes/common.sh +ADD topsrcdir/testing/docker/recipes/common.sh /setup/common.sh + +# %include testing/docker/recipes/install-mercurial.sh +ADD topsrcdir/testing/docker/recipes/install-mercurial.sh /setup/install-mercurial.sh + +# %include testing/docker/recipes/centos6-build-system-setup.sh +ADD topsrcdir/testing/docker/recipes/centos6-build-system-setup.sh /setup/system-setup.sh + +# TODO remove once base image doesn't install Mercurial +RUN pip uninstall -y Mercurial + +RUN bash /setup/system-setup.sh + +# Add wrapper scripts for xvfb allowing tasks to easily retry starting up xvfb +# %include testing/docker/recipes/xvfb.sh +ADD topsrcdir/testing/docker/recipes/xvfb.sh /home/worker/scripts/xvfb.sh + +# %include testing/docker/recipes/run-task +ADD topsrcdir/testing/docker/recipes/run-task /home/worker/bin/run-task + +# Add configuration +COPY dot-config /home/worker/.config + +# Generate machine uuid file +RUN dbus-uuidgen --ensure=/var/lib/dbus/machine-id + +# Stubbed out credentials; mozharness looks for this file an issues a WARNING +# if it's not found, which causes the build to fail. Note that this needs to +# be in the parent of the workspace directory and in the directory where +# mozharness is run (not its --work-dir). See Bug 1169652. +ADD oauth.txt /home/worker/ + +# stubbed out buildprops, which keeps mozharness from choking +# Note that this needs to be in the parent of the workspace directory and in +# the directory where mozharness is run (not its --work-dir) +ADD buildprops.json /home/worker/ + +# Move installation to base centos6-build image once Bug 1272629 is fixed +# Install the screen package here to use with xvfb. +# Install bison to build binutils. +RUN yum install -y bison screen + +# Set a default command useful for debugging +CMD ["/bin/bash", "--login"] diff --git a/testing/docker/desktop-build/bin/build.sh b/testing/docker/desktop-build/bin/build.sh new file mode 100644 index 000000000..b7e1502a9 --- /dev/null +++ b/testing/docker/desktop-build/bin/build.sh @@ -0,0 +1,36 @@ +#! /bin/bash -vex + +set -x -e -v + +# Relative path to in-tree script +: JOB_SCRIPT ${JOB_SCRIPT:=taskcluster/scripts/builder/build-linux.sh} + +script_args="${@}" + +# TODO: when bug 1093833 is solved and tasks can run as non-root, reduce this +# to a simple fail-if-root check +if [ $(id -u) = 0 ]; then + # each of the caches we have mounted are owned by root, so update that ownership + # to 'worker' + for cache in /home/worker/.tc-vcs /home/worker/workspace /home/worker/tooltool-cache; do + if [ -d $cache ]; then + # -R probably isn't necessary forever, but it fixes some poisoned + # caches for now + chown -R worker:worker $cache + fi + done + + # ..then drop privileges by re-running this script + exec su worker -c "/home/worker/bin/build.sh $script_args" +fi + +#### +# The default build works for any fx_desktop_build based mozharness job: +# via build-linux.sh +#### + +. $HOME/bin/checkout-sources.sh + +script=$WORKSPACE/build/src/$JOB_SCRIPT +chmod +x $script +exec $script $script_args diff --git a/testing/docker/desktop-build/bin/checkout-script.sh b/testing/docker/desktop-build/bin/checkout-script.sh new file mode 100644 index 000000000..2bacf3f01 --- /dev/null +++ b/testing/docker/desktop-build/bin/checkout-script.sh @@ -0,0 +1,17 @@ +#! /bin/bash -vex + +set -x -e + +# Inputs, with defaults + +: GECKO_HEAD_REPOSITORY ${GECKO_HEAD_REPOSITORY:=https://hg.mozilla.org/mozilla-central} +: GECKO_HEAD_REV ${GECKO_HEAD_REV:=default} + +: SCRIPT_DOWNLOAD_PATH ${SCRIPT_DOWNLOAD_PATH:=$PWD} +: SCRIPT_PATH ${SCRIPT_PATH:?"script path must be set"} +set -v + +# download script from the gecko repository +url=${GECKO_HEAD_REPOSITORY}/raw-file/${GECKO_HEAD_REV}/${SCRIPT_PATH} +wget --directory-prefix=${SCRIPT_DOWNLOAD_PATH} $url +chmod +x `basename ${SCRIPT_PATH}` diff --git a/testing/docker/desktop-build/bin/checkout-sources.sh b/testing/docker/desktop-build/bin/checkout-sources.sh new file mode 100644 index 000000000..9080472bc --- /dev/null +++ b/testing/docker/desktop-build/bin/checkout-sources.sh @@ -0,0 +1,55 @@ +#! /bin/bash -vex + +set -x -e + +# Inputs, with defaults + +# mozharness builds use two repositories: gecko (source) +# and build-tools (miscellaneous) for each, specify *_REPOSITORY. If the +# revision is not in the standard repo for the codebase, specify *_BASE_REPO as +# the canonical repo to clone and *_HEAD_REPO as the repo containing the +# desired revision. For Mercurial clones, only *_HEAD_REV is required; for Git +# clones, specify the branch name to fetch as *_HEAD_REF and the desired sha1 +# as *_HEAD_REV. + +: GECKO_REPOSITORY ${GECKO_REPOSITORY:=https://hg.mozilla.org/mozilla-central} +: GECKO_BASE_REPOSITORY ${GECKO_BASE_REPOSITORY:=${GECKO_REPOSITORY}} +: GECKO_HEAD_REPOSITORY ${GECKO_HEAD_REPOSITORY:=${GECKO_REPOSITORY}} +: GECKO_HEAD_REV ${GECKO_HEAD_REV:=default} +: GECKO_HEAD_REF ${GECKO_HEAD_REF:=${GECKO_HEAD_REV}} + +: TOOLS_REPOSITORY ${TOOLS_REPOSITORY:=https://hg.mozilla.org/build/tools} +: TOOLS_BASE_REPOSITORY ${TOOLS_BASE_REPOSITORY:=${TOOLS_REPOSITORY}} +: TOOLS_HEAD_REPOSITORY ${TOOLS_HEAD_REPOSITORY:=${TOOLS_REPOSITORY}} +: TOOLS_HEAD_REV ${TOOLS_HEAD_REV:=default} +: TOOLS_HEAD_REF ${TOOLS_HEAD_REF:=${TOOLS_HEAD_REV}} +: TOOLS_DISABLE ${TOOLS_DISABLE:=false} + +: WORKSPACE ${WORKSPACE:=/home/worker/workspace} + +set -v + +# check out tools where mozharness expects it to be ($PWD/build/tools and $WORKSPACE/build/tools) +if [ ! "$TOOLS_DISABLE" = true ] +then + tc-vcs checkout $WORKSPACE/build/tools $TOOLS_BASE_REPOSITORY $TOOLS_HEAD_REPOSITORY $TOOLS_HEAD_REV $TOOLS_HEAD_REF + + if [ ! -d build ]; then + mkdir -p build + ln -s $WORKSPACE/build/tools build/tools + fi +fi + +# TODO - include tools repository in EXTRA_CHECKOUT_REPOSITORIES list +for extra_repo in $EXTRA_CHECKOUT_REPOSITORIES; do + BASE_REPO="${extra_repo}_BASE_REPOSITORY" + HEAD_REPO="${extra_repo}_HEAD_REPOSITORY" + HEAD_REV="${extra_repo}_HEAD_REV" + HEAD_REF="${extra_repo}_HEAD_REF" + DEST_DIR="${extra_repo}_DEST_DIR" + + tc-vcs checkout ${!DEST_DIR} ${!BASE_REPO} ${!HEAD_REPO} ${!HEAD_REV} ${!HEAD_REF} +done + +export GECKO_DIR=$WORKSPACE/build/src +tc-vcs checkout $GECKO_DIR $GECKO_BASE_REPOSITORY $GECKO_HEAD_REPOSITORY $GECKO_HEAD_REV $GECKO_HEAD_REF diff --git a/testing/docker/desktop-build/buildprops.json b/testing/docker/desktop-build/buildprops.json new file mode 100644 index 000000000..f38b7d788 --- /dev/null +++ b/testing/docker/desktop-build/buildprops.json @@ -0,0 +1,9 @@ +{ + "properties": { + "buildername": "" + }, + "sourcestamp": { + "changes": [] + }, + "comments": "TaskCluster Job" +} diff --git a/testing/docker/desktop-build/dot-config/pip/pip.conf b/testing/docker/desktop-build/dot-config/pip/pip.conf new file mode 100644 index 000000000..73c2b2a52 --- /dev/null +++ b/testing/docker/desktop-build/dot-config/pip/pip.conf @@ -0,0 +1,2 @@ +[global] +disable-pip-version-check = true diff --git a/testing/docker/desktop-build/oauth.txt b/testing/docker/desktop-build/oauth.txt new file mode 100644 index 000000000..e56c71f57 --- /dev/null +++ b/testing/docker/desktop-build/oauth.txt @@ -0,0 +1,2 @@ +taskcluster_clientId = None +taskcluster_accessToken = None |