runme.sh (2034B)
1 #!/bin/bash 2 3 set -xe 4 5 # Things to be set by task definition. 6 # --pinset --hsts --hpkp 7 # -b branch 8 # --use-mozilla-central 9 # -p firefox 10 # Artifact directory 11 # Artifact names. 12 13 14 test "${BRANCH}" 15 test "${PRODUCT}" 16 17 PARAMS="" 18 19 if [ -n "${USE_MOZILLA_CENTRAL}" ] 20 then 21 PARAMS="${PARAMS} --use-mozilla-central" 22 fi 23 24 # TODO change these, so that they're run if the artifact location is specified? 25 if [ -n "${DO_HSTS}" ] 26 then 27 PARAMS="${PARAMS} --hsts" 28 fi 29 30 if [ -n "${DO_HPKP}" ] 31 then 32 PARAMS="${PARAMS} --hpkp" 33 fi 34 35 if [ -n "${DO_REMOTE_SETTINGS}" ] 36 then 37 PARAMS="${PARAMS} --remote-settings" 38 fi 39 40 if [ -n "${DO_SUFFIX_LIST}" ] 41 then 42 PARAMS="${PARAMS} --suffix-list" 43 fi 44 45 if [ -n "${DO_MOBILE_EXPERIMENTS}" ] 46 then 47 PARAMS="${PARAMS} --mobile-experiments" 48 fi 49 50 if [ -n "${DO_CT_LOGS}" ] 51 then 52 PARAMS="${PARAMS} --ct-logs" 53 fi 54 55 if [ -n "${DONTBUILD}" ] 56 then 57 PARAMS="${PARAMS} -d" 58 fi 59 60 61 export ARTIFACTS_DIR="/home/worker/artifacts" 62 mkdir -p "$ARTIFACTS_DIR" 63 64 # duplicate the functionality of taskcluster-lib-urls, but in bash.. 65 queue_base="$TASKCLUSTER_ROOT_URL/api/queue/v1" 66 67 # Get Arcanist API token 68 69 if [ -n "${TASK_ID}" ] 70 then 71 curl --location --retry 10 --retry-delay 10 -o /home/worker/task.json "$queue_base/task/$TASK_ID" 72 ARC_SECRET=$(jq -r '.scopes[] | select(contains ("arc-phabricator-token"))' /home/worker/task.json | awk -F: '{print $3}') 73 fi 74 if [ -n "${ARC_SECRET}" ] && getent hosts taskcluster 75 then 76 set +x # Don't echo these 77 secrets_url="${TASKCLUSTER_PROXY_URL}/api/secrets/v1/secret/${ARC_SECRET}" 78 SECRET=$(curl "${secrets_url}") 79 TOKEN=$(echo "${SECRET}" | jq -r '.secret.token') 80 elif [ -n "${ARC_TOKEN}" ] # Allow for local testing. 81 then 82 TOKEN="${ARC_TOKEN}" 83 fi 84 85 if [ -n "${TOKEN}" ] 86 then 87 cat >"${HOME}/.arcrc" <<END 88 { 89 "hosts": { 90 "https://phabricator.services.mozilla.com/api/": { 91 "token": "${TOKEN}" 92 } 93 } 94 } 95 END 96 set -x 97 chmod 600 "${HOME}/.arcrc" 98 fi 99 100 export HGPLAIN=1 101 102 # shellcheck disable=SC2086 103 /home/worker/scripts/periodic_file_updates.sh -p "${PRODUCT}" -b "${BRANCH}" -a ${PARAMS}