update-references.sh (864B)
1 #!/bin/bash 2 3 TASK_ID=${1} 4 THIS="$(dirname "$0")" 5 THERE=${2} 6 7 if [ -z "${TASK_ID}" ]; then 8 echo "Please provide a task ID" 9 exit 1 10 fi 11 12 TASKCLUSTER_API_ROOT="https://firefox-ci-tc.services.mozilla.com" 13 ARTIFACTS="${TASKCLUSTER_API_ROOT}/api/queue/v1/task/${TASK_ID}/artifacts" 14 15 for reference in $(curl "${ARTIFACTS}" | jq -r '.artifacts | . [] | select(.name | contains("public/build/new_")) | .name'); 16 do 17 name="$(basename "${reference}")" 18 final_name=${name//new_/} 19 target_name=$(find "${THIS}" -type f -name "${final_name}") 20 if [ -n "${THERE}" ]; then 21 # shellcheck disable=SC2001 22 target_name=$(echo "${target_name}" | sed -e "s/\.png$/-${THERE}.png/g") 23 fi 24 url="${TASKCLUSTER_API_ROOT}/api/queue/v1/task/${TASK_ID}/artifacts/${reference}" 25 echo "$url => $target_name" 26 curl -SL "${url}" -o "${target_name}" 27 done;