From d867d96ee129ef9599a562ff0cf6e6326128bd8c Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Mon, 27 Nov 2023 15:17:24 +0000 Subject: [PATCH] Bug 1850914 - add script to update test parameters.yml. r=releng-reviewers,ahal,gabriel If called with no arguments it'll update all files (except try.yml and mr-onpush-geckoview.yml). It can also be called with a set of filenames as arguments and will update just those files. For on-push and cron tasks, we look up the taskcluster index for the latest corresponding decision task (or possibly an older one in case of DONTBUILD pushes). For release promotion actions, we query the public shipit API to find the latest matching task. Differential Revision: https://phabricator.services.mozilla.com/D187137 --- taskcluster/test/params/update.sh | 123 +++++++++++++++++++++++++++++++ taskcluster/test/test_generate_params.py | 2 +- 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 taskcluster/test/params/update.sh diff --git a/taskcluster/test/params/update.sh b/taskcluster/test/params/update.sh new file mode 100644 index 000000000000..e09333a2e7bc --- /dev/null +++ b/taskcluster/test/params/update.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +set -ex + +TASKCLUSTER_ROOT_URL=https://firefox-ci-tc.services.mozilla.com + +dir=$(dirname "$0") +if [ -n "$1" ]; then + files="$@" +else + files=$(ls -1 "$dir"/*.yml) +fi +for f in $files; do + base=$(basename "$f" .yml) + repo=${base%%-*} + action=${base#*-} + # remove people's email addresses + filter='.owner="user@example.com"' + + case $repo in + mc) + repo=mozilla-central + ;; + mb) + repo=mozilla-beta + ;; + mr) + repo=mozilla-release + ;; + me) + version=$(curl -s https://product-details.mozilla.org/1.0/firefox_versions.json | jq -r .FIREFOX_ESR) + version=${version%%.*} + repo=mozilla-esr${version} + # unset enable_always_target to fall back to the default, to avoid + # generating a broken graph with esr115 params + filter="$filter | del(.enable_always_target)" + ;; + autoland) + ;; + try) + continue + ;; + *) + echo unknown repo $repo >&2 + exit 1 + ;; + esac + + case $action in + onpush) + task=gecko.v2.${repo}.latest.taskgraph.decision + service=index + # find a non-DONTBUILD push + while :; do + params=$(curl -f -L ${TASKCLUSTER_ROOT_URL}/api/${service}/v1/task/${task}/artifacts/public%2Fparameters.yml) + method=$(echo "$params" | yq -r .target_tasks_method) + if [ $method != nothing ]; then + break + fi + pushlog_id=$(echo "$params" | yq -r .pushlog_id) + task=gecko.v2.${repo}.pushlog-id.$((pushlog_id - 1)).decision + done + ;; + onpush-geckoview) + # this one is weird, ignore it + continue + ;; + cron-*) + task=${action#cron-} + task=gecko.v2.${repo}.latest.taskgraph.decision-${task} + service=index + ;; + desktop-nightly) + task=gecko.v2.${repo}.latest.taskgraph.decision-nightly-desktop + service=index + ;; + ship-geckoview) + task=gecko.v2.${repo}.latest.taskgraph.decision-ship-geckoview + service=index + ;; + push*|promote*|ship*) + case $action in + *-partials) + action=${action%-partials} + ;; + *) + filter="$filter | .release_history={}" + ;; + esac + suffix= + case $action in + *-firefox-rc) + product=firefox + action=${action%-firefox-rc} + suffix=_rc + ;; + *-firefox) + product=firefox + action=${action%-$product} + ;; + *-devedition) + product=devedition + action=${action%-$product} + ;; + *) + echo unknown action $action >&2 + exit 1 + ;; + esac + phase=${action}_${product}${suffix} + # grab the action task id from the latest release where this phase wasn't skipped + task=$(curl -s "https://shipitapi-public.services.mozilla.com/releases?product=${product}&branch=releases/${repo}&status=shipped" | \ + jq -r "map(.phases[] | select(.name == "'"'"$phase"'"'" and (.skipped | not)))[-1].actionTaskId") + service=queue + ;; + *) + echo unknown action $action >&2 + exit 1 + ;; + esac + + curl -f -L ${TASKCLUSTER_ROOT_URL}/api/${service}/v1/task/${task}/artifacts/public%2Fparameters.yml | yq -y "$filter" > "${f}" +done diff --git a/taskcluster/test/test_generate_params.py b/taskcluster/test/test_generate_params.py index 87f1fe341cf7..be600adc6cc3 100644 --- a/taskcluster/test/test_generate_params.py +++ b/taskcluster/test/test_generate_params.py @@ -41,7 +41,7 @@ def get_graph_from_spec(tmpdir_factory): @pytest.mark.parametrize( - "param_spec", [os.path.splitext(p)[0] for p in os.listdir(PARAMS_DIR)] + "param_spec", [os.path.splitext(p)[0] for p in os.listdir(PARAMS_DIR) if p.endswith(".yml")] ) def test_generate_graphs(get_graph_from_spec, param_spec): ret = get_graph_from_spec(param_spec) -- 2.11.4.GIT