Bug 1492664 - update periodic-updates to use TASKCLUSTER_ROOT_URL; r=sfraser
authorDustin J. Mitchell <dustin@mozilla.com>
Tue, 02 Oct 2018 16:52:47 +0000
changeset 509171 1f7b787349b838850fc4b73e29191efbf564d483
parent 509170 f61ad7db75d493a04804eb9d797016a36d6e91a4
child 509172 3808fda372b11df2e3db56c763b9364215f5fefe
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfraser
bugs1492664
milestone66.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 1492664 - update periodic-updates to use TASKCLUSTER_ROOT_URL; r=sfraser
taskcluster/docker/periodic-updates/runme.sh
taskcluster/docker/periodic-updates/scripts/periodic_file_updates.sh
--- a/taskcluster/docker/periodic-updates/runme.sh
+++ b/taskcluster/docker/periodic-updates/runme.sh
@@ -46,28 +46,35 @@ if [ ! -z "${DO_SUFFIX_LIST}" ]
 then
   PARAMS="${PARAMS} --suffix-list"
 fi
 
 
 export ARTIFACTS_DIR="/home/worker/artifacts"
 mkdir -p "$ARTIFACTS_DIR"
 
+# duplicate the functionality of taskcluster-lib-urls, but in bash..
+if [ "$TASKCLUSTER_ROOT_URL" = "https://taskcluster.net" ]; then
+    queue_base='https://queue.taskcluster.net/v1'
+else
+    queue_base="$TASKCLUSTER_ROOT_URL/api/queue/v1"
+fi
+
 # Get Arcanist API token
 
 if [ -n "${TASK_ID}" ]
 then
-  curl --location --retry 10 --retry-delay 10 -o /home/worker/task.json \
-    "https://queue.taskcluster.net/v1/task/$TASK_ID"
+  curl --location --retry 10 --retry-delay 10 -o /home/worker/task.json "$queue_base/task/$TASK_ID"
   ARC_SECRET=$(jq -r '.scopes[] | select(contains ("arc-phabricator-token"))' /home/worker/task.json | awk -F: '{print $3}')
 fi
 if [ -n "${ARC_SECRET}" ] && getent hosts taskcluster
 then
   set +x # Don't echo these
-  secrets_url="http://taskcluster/secrets/v1/secret/${ARC_SECRET}"
+  # Until bug 1460015 is finished, use baseUrl-style proxy URLs
+  secrets_url="${TASKCLUSTER_PROXY_URL}/secrets/v1/secret/${ARC_SECRET}"
   SECRET=$(curl "${secrets_url}")
   TOKEN=$(echo "${SECRET}" | jq -r '.secret.token')
 elif [ -n "${ARC_TOKEN}" ] # Allow for local testing.
 then
   TOKEN="${ARC_TOKEN}"
 fi
 
 if [ -n "${TOKEN}" ]
--- a/taskcluster/docker/periodic-updates/scripts/periodic_file_updates.sh
+++ b/taskcluster/docker/periodic-updates/scripts/periodic_file_updates.sh
@@ -90,16 +90,25 @@ SUFFIX_LIST_UPDATED=false
 ARTIFACTS_DIR="${ARTIFACTS_DIR:-.}"
 # Defaults
 HSTS_DIFF_ARTIFACT="${ARTIFACTS_DIR}/${HSTS_DIFF_ARTIFACT:-"nsSTSPreloadList.diff"}"
 HPKP_DIFF_ARTIFACT="${ARTIFACTS_DIR}/${HPKP_DIFF_ARTIFACT:-"StaticHPKPins.h.diff"}"
 BLOCKLIST_DIFF_ARTIFACT="${ARTIFACTS_DIR}/${BLOCKLIST_DIFF_ARTIFACT:-"blocklist.diff"}"
 REMOTE_SETTINGS_DIFF_ARTIFACT="${ARTIFACTS_DIR}/${REMOTE_SETTINGS_DIFF_ARTIFACT:-"remote-settings.diff"}"
 SUFFIX_LIST_DIFF_ARTIFACT="${ARTIFACTS_DIR}/${SUFFIX_LIST_DIFF_ARTIFACT:-"effective_tld_names.diff"}"
 
+# duplicate the functionality of taskcluster-lib-urls, but in bash..
+if [ "$TASKCLUSTER_ROOT_URL" = "https://taskcluster.net" ]; then
+    queue_base='https://queue.taskcluster.net/v1'
+    index_base='https://index.taskcluster.net/v1'
+else
+    queue_base="$TASKCLUSTER_ROOT_URL/api/queue/v1"
+    index_base="$TASKCLUSTER_ROOT_URL/api/index/v1"
+fi
+
 # Get the current in-tree version for a code branch.
 function get_version {
   VERSION_REPO=$1
   VERSION_FILE='version.txt'
 
   # TODO bypass temporary file
 
   cd "${BASEDIR}"
@@ -141,40 +150,40 @@ function download_shared_artifacts_from_
 }
 
 function download_shared_artifacts_from_tc {
   cd "${BASEDIR}"
   TASKID_FILE="taskId.json"
 
   # Download everything we need to run js with xpcshell
   echo "INFO: Downloading all the necessary pieces from the taskcluster index..."
-  TASKID_URL="https://index.taskcluster.net/v1/task/gecko.v2.${REPODIR}.latest.${PRODUCT}.linux64-opt"
+  TASKID_URL="$index_base/task/gecko.v2.${REPODIR}.latest.${PRODUCT}.linux64-opt"
   if [ "${USE_MC}" == "true" ]; then
-    TASKID_URL="https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.latest.${PRODUCT}.linux64-opt"
+    TASKID_URL="$index_base/task/gecko.v2.mozilla-central.latest.${PRODUCT}.linux64-opt"
   fi
-  ${WGET} -O ${TASKID_FILE} ${TASKID_URL}
+  ${WGET} -O ${TASKID_FILE} "${TASKID_URL}"
   INDEX_TASK_ID="$($JQ -r '.taskId' ${TASKID_FILE})"
   if [ -z "${INDEX_TASK_ID}" ]; then
     echo "Failed to look up taskId at ${TASKID_URL}"
     exit 22
   else
     echo "INFO: Got taskId of $INDEX_TASK_ID"
   fi
 
   TASKSTATUS_FILE="taskstatus.json"
-  STATUS_URL="https://queue.taskcluster.net/v1/task/${INDEX_TASK_ID}/status"
+  STATUS_URL="$queue_base/task/${INDEX_TASK_ID}/status"
   ${WGET} -O "${TASKSTATUS_FILE}" "${STATUS_URL}"
   LAST_RUN_INDEX=$(($(jq '.status.runs | length' ${TASKSTATUS_FILE}) - 1))
   echo "INFO: Examining run number ${LAST_RUN_INDEX}"
 
-  BROWSER_ARCHIVE_URL="https://queue.taskcluster.net/v1/task/${INDEX_TASK_ID}/runs/${LAST_RUN_INDEX}/artifacts/public/build/${BROWSER_ARCHIVE}"
+  BROWSER_ARCHIVE_URL="$queue_base/task/${INDEX_TASK_ID}/runs/${LAST_RUN_INDEX}/artifacts/public/build/${BROWSER_ARCHIVE}"
   echo "INFO: ${WGET} ${BROWSER_ARCHIVE_URL}"
   ${WGET} "${BROWSER_ARCHIVE_URL}"
 
-  TESTS_ARCHIVE_URL="https://queue.taskcluster.net/v1/task/${INDEX_TASK_ID}/runs/${LAST_RUN_INDEX}/artifacts/public/build/${TESTS_ARCHIVE}"
+  TESTS_ARCHIVE_URL="$queue_base/task/${INDEX_TASK_ID}/runs/${LAST_RUN_INDEX}/artifacts/public/build/${TESTS_ARCHIVE}"
   echo "INFO: ${WGET} ${TESTS_ARCHIVE_URL}"
   ${WGET} "${TESTS_ARCHIVE_URL}"
 }
 
 function unpack_artifacts {
   cd "${BASEDIR}"
   if [ ! -f "${BROWSER_ARCHIVE}" ]; then
     echo "Downloaded file '${BROWSER_ARCHIVE}' not found in directory '$(pwd)'." >&2