File: update.sh

package info (click to toggle)
firefox 147.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,683,324 kB
  • sloc: cpp: 7,607,156; javascript: 6,532,492; ansic: 3,775,158; python: 1,415,368; xml: 634,556; asm: 438,949; java: 186,241; sh: 62,751; makefile: 18,079; objc: 13,092; perl: 12,808; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10; exp: 6
file content (137 lines) | stat: -rw-r--r-- 4,448 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/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
            ;;
        nightly-all)
            task=gecko.v2.${repo}.latest.taskgraph.decision-nightly-all
            service=index
            ;;
        android-nightly)
            task=gecko.v2.${repo}.latest.taskgraph.decision-nightly-android
            service=index
            ;;
        desktop-nightly)
            task=gecko.v2.${repo}.latest.taskgraph.decision-nightly-desktop
            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}
                    phase=${action}_${product}_rc
                    ;;
                *-firefox)
                    product=firefox
                    action=${action%-$product}
                    phase=${action}_${product}
                    ;;
                *-devedition)
                    product=devedition
                    action=${action%-$product}
                    phase=${action}_${product}
                    ;;
                *-android)
                    product=firefox-android
                    action=${action%-android}
                    phase=${action}_android
                    ;;
                *)
                    echo unknown action $action >&2
                    exit 1
                    ;;
            esac
            # 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
            ;;
        *merge-automation)
            # these tasks have no useful indexes; unable to update them automatically
            continue
            ;;
        *)
            echo unknown action $action >&2
            exit 1
            ;;
    esac

    curl -f -L ${TASKCLUSTER_ROOT_URL}/api/${service}/v1/task/${task}/artifacts/public%2Fparameters.yml | yq -oy "$filter" > "${f}"
done