Bug 1247168 - Use robustcheckout in desktop-build task; r?dustin draft
authorGregory Szorc <gps@mozilla.com>
Tue, 19 Jul 2016 16:30:23 -0700
changeset 390280 bd187428ca7fe1953b011f43b71183147a55ef47
parent 390279 b9b905cc9f3004747ba52b60aba1acc058d7d531
child 525973 34d558149b5bf3e669216b78fe1a30bcea07a6a1
push id23641
push userbmo:gps@mozilla.com
push dateWed, 20 Jul 2016 23:45:40 +0000
reviewersdustin
bugs1247168
milestone50.0a1
Bug 1247168 - Use robustcheckout in desktop-build task; r?dustin Like we've done for the lint tasks, we convert desktop-build to use the robustcheckout extension instead of tc-vcs. The logic is slightly more complicated because of various environment variables. Some unused environment variables have been removed. MozReview-Commit-ID: Jv98eUxibvd
taskcluster/ci/legacy/tasks/docker_build.yml
testing/docker/desktop-build/Dockerfile
testing/docker/desktop-build/bin/checkout-sources.sh
--- a/taskcluster/ci/legacy/tasks/docker_build.yml
+++ b/taskcluster/ci/legacy/tasks/docker_build.yml
@@ -5,23 +5,24 @@
 task:
   workerType: b2gbuild
 
   routes:
     - 'index.gecko.v1.{{project}}.revision.linux.{{head_rev}}.{{build_name}}.{{build_type}}'
     - 'index.gecko.v1.{{project}}.latest.linux.{{build_name}}.{{build_type}}'
 
   scopes:
-    # docker build tasks use tc-vcs so include the scope.
     - 'docker-worker:cache:level-{{level}}-{{project}}-tc-vcs'
+    - 'docker-worker:cache:level-{{level}}-hg-shared'
 
   payload:
 
     cache:
       level-{{level}}-{{project}}-tc-vcs: '/home/worker/.tc-vcs'
+      level-{{level}}-hg-shared: '/home/worker/hg-shared'
 
     # All docker builds share a common artifact directory for ease of uploading.
     artifacts:
       'public/build':
         type: directory
         path: '/home/worker/artifacts/'
         expires:
           relative-datestamp: '1 year'
--- a/testing/docker/desktop-build/Dockerfile
+++ b/testing/docker/desktop-build/Dockerfile
@@ -1,9 +1,9 @@
-FROM          taskcluster/centos6-build-upd:0.1.6.20160329195300
+FROM          taskcluster/centos6-build-upd:0.1.7.201607192200
 MAINTAINER    Dustin J. Mitchell <dustin@mozilla.com>
 
 # 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/*
 
 # Add configuration
--- a/testing/docker/desktop-build/bin/checkout-sources.sh
+++ b/testing/docker/desktop-build/bin/checkout-sources.sh
@@ -7,49 +7,56 @@ set -x -e
 # 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_BASE_REPOSITORY         ${GECKO_BASE_REPOSITORY:=https://hg.mozilla.org/mozilla-unified}
+: GECKO_HEAD_REPOSITORY         ${GECKO_HEAD_REPOSITORY:=https://hg.mozilla.org/mozilla-central}
 : 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_REPOSITORY         ${TOOLS_HEAD_REPOSITORY:=https://hg.mozilla.org/build/tools}
 : 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
 
+checkoutargs="--purge --sharebase /home/worker/hg-shared"
+
 # 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 [ -n "${TOOLS_HEAD_REV}" ]; then
+      args="${checkoutargs} --revision ${TOOLS_HEAD_REV}"
+    else
+      args="${checkoutargs} --branch ${TOOLS_HEAD_REF}"
+    fi
 
-    if [ ! -d build ]; then
-        mkdir -p build
-        ln -s $WORKSPACE/build/tools build/tools
-    fi
+    mkdir -p build ${WORKSPACE}/build
+    hg robustcheckout ${args} ${TOOLS_HEAD_REPOSITORY} ${WORKSPACE}/build/tools
+    hg robustcheckout ${args} ${TOOLS_HEAD_REPOSITORY} build/tools
 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
+if [ -n "${GECKO_HEAD_REV}" ]; then
+  args="${checkoutargs} --revision ${GECKO_HEAD_REV}"
+else
+  args="${checkoutargs} --branch ${GECKO_HEAD_REF}"
+fi
+
+hg robustcheckout ${args} --upstream ${GECKO_BASE_REPOSITORY} \
+  ${GECKO_HEAD_REPOSITORY} ${WORKSPACE}/build/src