update.sh (4448B)
1 #!/bin/bash 2 3 set -ex 4 5 TASKCLUSTER_ROOT_URL=https://firefox-ci-tc.services.mozilla.com 6 7 dir=$(dirname "$0") 8 if [ -n "$1" ]; then 9 files="$@" 10 else 11 files=$(ls -1 "$dir"/*.yml) 12 fi 13 for f in $files; do 14 base=$(basename "$f" .yml) 15 repo=${base%%-*} 16 action=${base#*-} 17 # remove people's email addresses 18 filter='.owner="user@example.com"' 19 20 case $repo in 21 mc) 22 repo=mozilla-central 23 ;; 24 mb) 25 repo=mozilla-beta 26 ;; 27 mr) 28 repo=mozilla-release 29 ;; 30 me) 31 version=$(curl -s https://product-details.mozilla.org/1.0/firefox_versions.json | jq -r .FIREFOX_ESR) 32 version=${version%%.*} 33 repo=mozilla-esr${version} 34 # unset enable_always_target to fall back to the default, to avoid 35 # generating a broken graph with esr115 params 36 filter="$filter | del(.enable_always_target)" 37 ;; 38 autoland) 39 ;; 40 try) 41 continue 42 ;; 43 *) 44 echo unknown repo $repo >&2 45 exit 1 46 ;; 47 esac 48 49 case $action in 50 onpush) 51 task=gecko.v2.${repo}.latest.taskgraph.decision 52 service=index 53 # find a non-DONTBUILD push 54 while :; do 55 params=$(curl -f -L ${TASKCLUSTER_ROOT_URL}/api/${service}/v1/task/${task}/artifacts/public%2Fparameters.yml) 56 method=$(echo "$params" | yq -r .target_tasks_method) 57 if [ $method != nothing ]; then 58 break 59 fi 60 pushlog_id=$(echo "$params" | yq -r .pushlog_id) 61 task=gecko.v2.${repo}.pushlog-id.$((pushlog_id - 1)).decision 62 done 63 ;; 64 onpush-geckoview) 65 # this one is weird, ignore it 66 continue 67 ;; 68 cron-*) 69 task=${action#cron-} 70 task=gecko.v2.${repo}.latest.taskgraph.decision-${task} 71 service=index 72 ;; 73 nightly-all) 74 task=gecko.v2.${repo}.latest.taskgraph.decision-nightly-all 75 service=index 76 ;; 77 android-nightly) 78 task=gecko.v2.${repo}.latest.taskgraph.decision-nightly-android 79 service=index 80 ;; 81 desktop-nightly) 82 task=gecko.v2.${repo}.latest.taskgraph.decision-nightly-desktop 83 service=index 84 ;; 85 push*|promote*|ship*) 86 case $action in 87 *-partials) 88 action=${action%-partials} 89 ;; 90 *) 91 filter="$filter | .release_history={}" 92 ;; 93 esac 94 suffix= 95 case $action in 96 *-firefox-rc) 97 product=firefox 98 action=${action%-firefox-rc} 99 phase=${action}_${product}_rc 100 ;; 101 *-firefox) 102 product=firefox 103 action=${action%-$product} 104 phase=${action}_${product} 105 ;; 106 *-devedition) 107 product=devedition 108 action=${action%-$product} 109 phase=${action}_${product} 110 ;; 111 *-android) 112 product=firefox-android 113 action=${action%-android} 114 phase=${action}_android 115 ;; 116 *) 117 echo unknown action $action >&2 118 exit 1 119 ;; 120 esac 121 # grab the action task id from the latest release where this phase wasn't skipped 122 task=$(curl -s "https://shipitapi-public.services.mozilla.com/releases?product=${product}&branch=releases/${repo}&status=shipped" | \ 123 jq -r "map(.phases[] | select(.name == "'"'"$phase"'"'" and (.skipped | not)))[-1].actionTaskId") 124 service=queue 125 ;; 126 *merge-automation) 127 # these tasks have no useful indexes; unable to update them automatically 128 continue 129 ;; 130 *) 131 echo unknown action $action >&2 132 exit 1 133 ;; 134 esac 135 136 curl -f -L ${TASKCLUSTER_ROOT_URL}/api/${service}/v1/task/${task}/artifacts/public%2Fparameters.yml | yq -oy "$filter" > "${f}" 137 done