Update GeckoView (Nightly) to 124.0.20240130045011. (https://github.com/mozilla-mobil...
[gecko.git] / mobile / android / .taskcluster.yml
blob7c5aca346ed264fa20fb89e9638624fbc31a4a88
1 ---
2 version: 1
3 reporting: checks-v1
4 policy:
5     pullRequests: public_restricted
6 tasks:
7     - $let:
8           trustDomain: mobile
9           canonicalRepo: https://github.com/mozilla-mobile/firefox-android
10           isPullRequest:
11               # We now support both github-pull-request and github-pull-request-untrusted
12               $eval: 'tasks_for[:19] == "github-pull-request"'
14           ownTaskId:
15               $if: '"github" in tasks_for'
16               then: {$eval: as_slugid("decision_task")}
17               else:
18                   $if: 'tasks_for == "cron"'
19                   then: '${ownTaskId}'
20       in:
21           $let:
22               # Github events have this stuff in different places...
23               ownerEmail:
24                   $if: 'tasks_for in ["cron", "action"]'
25                   then: '${tasks_for}@noreply.mozilla.org'
26                   else:
27                       # GitHub adds "[bot]" to bot usernames and that doesn't validate as email.
28                       $if: 'event.sender.login == "bors[bot]"'
29                       then: 'skaspari+mozlando@mozilla.com'   # It must match what's in bors.toml
30                       else:
31                           $if: 'tasks_for == "github-push"'
32                           then:
33                               $if: 'event.pusher.email'
34                               then: '${event.pusher.email}'
35                               else: '${event.pusher.name}@users.noreply.github.com'
36                           else:
37                               $if: 'isPullRequest'
38                               then: '${event.pull_request.user.login}@users.noreply.github.com'
40               repoFullName:
41                   $if: 'tasks_for in "github-push"'
42                   then: '${event.repository.full_name}'
43                   else:
44                       $if: 'isPullRequest'
45                       then: '${event.pull_request.base.repo.full_name}'
46                       else:
47                           $if: 'tasks_for in ["cron", "action"]'
48                           # Trim https://github.com/
49                           then: '${repository.url[19:]}'
51               baseRepoUrl:
52                   $if: 'tasks_for == "github-push"'
53                   then: '${event.repository.html_url}'
54                   else:
55                       $if: 'isPullRequest'
56                       then: '${event.pull_request.base.repo.html_url}'
57                       else:
58                           $if: 'tasks_for in ["cron", "action"]'
59                           then: '${repository.url}'
60               repoUrl:
61                   $if: 'tasks_for == "github-push"'
62                   then: '${event.repository.html_url}'
63                   else:
64                       $if: 'isPullRequest'
65                       then: '${event.pull_request.head.repo.html_url}'
66                       else:
67                           $if: 'tasks_for in ["cron", "action"]'
68                           then: '${repository.url}'
69               project:
70                   $if: 'tasks_for == "github-push"'
71                   then: '${event.repository.name}'
72                   else:
73                       $if: 'isPullRequest'
74                       then: '${event.pull_request.head.repo.name}'
75                       else:
76                           $if: 'tasks_for in ["cron", "action"]'
77                           then: '${repository.project}'
78               base_ref:
79                   $if: 'isPullRequest'
80                   then: ${event.pull_request.base.ref}
81                   else:
82                       # event.base_ref is barely documented[1]. Testing showed it's only
83                       # defined when creating a new branch. It's null when pushing to an
84                       # existing branch
85                       #
86                       # [1] https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push
87                       $if: 'tasks_for == "github-push" && event.base_ref'
88                       then: ${event.base_ref}
89                       else:
90                           $if: 'tasks_for == "github-push"'
91                           then: ${event.ref}
92                           else:
93                               $if: 'tasks_for in ["cron", "action"]'
94                               then:
95                                 $if: 'push.branch[:11] == "refs/heads/"'
96                                 then: {$eval: 'push.branch[11:]'}
97                                 else: ${push.branch}
98               head_ref:
99                   $if: 'isPullRequest'
100                   then: ${event.pull_request.head.ref}
101                   else:
102                       $if: 'tasks_for == "github-push"'
103                       then: ${event.ref}
104                       else:
105                           $if: 'tasks_for in ["cron", "action"]'
106                           then: '${push.branch}'
107               base_sha:
108                   $if: 'tasks_for == "github-push"'
109                   then: '${event.before}'
110                   else:
111                       $if: 'isPullRequest'
112                       then: '${event.pull_request.base.sha}'
113                       else:
114                           $if: 'tasks_for in ["cron", "action"]'
115                           then: '${push.revision}'
116               head_sha:
117                   $if: 'tasks_for == "github-push"'
118                   then: '${event.after}'
119                   else:
120                       $if: 'isPullRequest'
121                       then: '${event.pull_request.head.sha}'
122                       else:
123                           $if: 'tasks_for in ["cron", "action"]'
124                           then: '${push.revision}'
125               pullRequestAction:
126                   $if: 'isPullRequest'
127                   then: ${event.action}
128                   else: 'UNDEFINED'
129           in:
130               $let:
131                   level:
132                       $if: >
133                           tasks_for in ["github-push", "action", "cron"] && repoUrl == canonicalRepo
134                       then: '3'
135                       else: '1'
137                   short_base_ref:
138                       $if: 'base_ref[:11] == "refs/heads/"'
139                       then: {$eval: 'base_ref[11:]'}
140                       else: ${base_ref}
142                   short_head_ref:
143                       $if: 'head_ref[:11] == "refs/heads/"'
144                       then: {$eval: 'head_ref[11:]'}
145                       else: ${head_ref}
146               in:
147                   $if: >
148                       tasks_for in ["action", "cron"]
149                       || (isPullRequest && pullRequestAction in ["opened", "reopened", "synchronize"])
150                       || (tasks_for == "github-push" && head_ref[:10] != "refs/tags/" && short_head_ref != "staging.tmp" && short_head_ref != "trying.tmp" && short_head_ref[:8] != "mergify/")
151                   then:
152                       $mergeDeep:
153                           - $if: 'tasks_for != "action"'
154                             then:
155                                 taskId: '${ownTaskId}'
156                           - taskGroupId:
157                                 $if: 'tasks_for == "action"'
158                                 then:
159                                     '${action.taskGroupId}'
160                                 else:
161                                     '${ownTaskId}'  # same as taskId; this is how automation identifies a decision task
162                             schedulerId: '${trustDomain}-level-${level}'
163                             created: {$fromNow: ''}
164                             deadline: {$fromNow: '1 day'}
165                             expires: {$fromNow: '1 year 1 second'}  # 1 second so artifacts expire first, despite rounding errors
166                             metadata:
167                                 $merge:
168                                     - owner: "${ownerEmail}"
169                                       source: '${repoUrl}/raw/${head_sha}/.taskcluster.yml'
170                                     - $if: 'isPullRequest || tasks_for == "github-push"'
171                                       then:
172                                           name: "Decision Task"
173                                           description: 'The task that creates all of the other tasks in the task graph'
174                                       else:
175                                           $if: 'tasks_for == "action"'
176                                           then:
177                                               name: "Action: ${action.title}"
178                                               description: |
179                                                       ${action.description}
181                                                       Action triggered by clientID `${clientId}`
182                                           else:
183                                               name: "Decision Task for cron job ${cron.job_name}"
184                                               description: 'Created by a [cron task](https://firefox-ci-tc.services.mozilla.com/tasks/${cron.task_id})'
185                             provisionerId: "mobile-${level}"
186                             workerType: "decision-gcp"
187                             tags:
188                                 $if: 'isPullRequest || tasks_for == "github-push"'
189                                 then:
190                                     kind: decision-task
191                                 else:
192                                     $if: 'tasks_for == "action"'
193                                     then:
194                                         kind: 'action-callback'
195                                     else:
196                                         $if: 'tasks_for == "cron"'
197                                         then:
198                                             kind: cron-task
199                             routes:
200                                 $flattenDeep:
201                                     - checks
202                                     - $if: 'level == "3" || repoUrl == "https://github.com/mozilla-releng/staging-firefox-android"'
203                                       then:
204                                           - tc-treeherder.v2.${project}.${head_sha}
205                                           - $if: 'tasks_for == "github-push"'
206                                             then:
207                                                 - index.mobile.v2.${project}.branch.${short_head_ref}.latest.taskgraph.decision
208                                                 - index.mobile.v2.${project}.branch.${short_head_ref}.revision.${head_sha}.taskgraph.decision
209                                                 - index.mobile.v2.${project}.revision.${head_sha}.taskgraph.decision
210                                           - $if: 'tasks_for == "cron"'
211                                             then:
212                                                 # cron context provides ${head_ref} as a short one
213                                                 - index.mobile.v2.${project}.branch.${head_ref}.latest.taskgraph.decision-${cron.job_name}
214                                                 - index.mobile.v2.${project}.branch.${head_ref}.revision.${head_sha}.taskgraph.decision-${cron.job_name}
215                                                 - index.mobile.v2.${project}.branch.${head_ref}.revision.${head_sha}.taskgraph.cron.${ownTaskId}
216                             scopes:
217                                 $if: 'tasks_for == "github-push"'
218                                 then:
219                                     - 'assume:repo:github.com/${repoFullName}:branch:${short_head_ref}'
220                                 else:
221                                     $if: 'isPullRequest'
222                                     then:
223                                         - 'assume:repo:github.com/${repoFullName}:${tasks_for[7:]}'
224                                     else:
225                                         $if: 'tasks_for == "action"'
226                                         then:
227                                             # when all actions are hooks, we can calculate this directly rather than using a variable
228                                             - '${action.repo_scope}'
229                                         else:
230                                             - 'assume:repo:github.com/${repoFullName}:cron:${cron.job_name}'
232                             requires: all-completed
233                             priority: lowest
234                             retries: 5
236                             payload:
237                                 env:
238                                     # run-task uses these to check out the source; the inputs
239                                     # to `mach taskgraph decision` are all on the command line.
240                                     $merge:
241                                         - MOBILE_BASE_REPOSITORY: '${baseRepoUrl}'
242                                           MOBILE_BASE_REF: '${short_base_ref}'
243                                           MOBILE_BASE_REV: '${base_sha}'
244                                           MOBILE_HEAD_REPOSITORY: '${repoUrl}'
245                                           MOBILE_HEAD_REF: '${short_head_ref}'
246                                           MOBILE_HEAD_REV: '${head_sha}'
247                                           MOBILE_PIP_REQUIREMENTS: taskcluster/requirements.txt
248                                           MOBILE_REPOSITORY_TYPE: git
249                                           MOZ_AUTOMATION: "1"
250                                           REPOSITORIES: {$json: {mobile: "firefox-android"}}
251                                         - $if: 'isPullRequest'
252                                           then:
253                                               MOBILE_PULL_REQUEST_NUMBER: '${event.pull_request.number}'
254                                         - $if: 'tasks_for == "action"'
255                                           then:
256                                               ACTION_TASK_GROUP_ID: '${action.taskGroupId}'  # taskGroupId of the target task
257                                               ACTION_TASK_ID: {$json: {$eval: 'taskId'}}  # taskId of the target task (JSON-encoded)
258                                               ACTION_INPUT: {$json: {$eval: 'input'}}
259                                               ACTION_CALLBACK: '${action.cb_name}'
260                                 features:
261                                     taskclusterProxy: true
262                                     chainOfTrust: true
263                                 # Note: This task is built server side without the context or tooling that
264                                 # exist in tree so we must hard code the hash
265                                 image:
266                                     mozillareleases/taskgraph:decision-10068f116a3800a829ddba367136a95bef5634e06f77e051859586202c93b18a@sha256:a74ed430fd80ebb647bb4a5b019523cf5f69246ed2c2603386dbc8f7200c8140
268                                 maxRunTime: 1800
270                                 command:
271                                     - /usr/local/bin/run-task
272                                     - '--mobile-checkout=/builds/worker/checkouts/vcs'
273                                     - '--task-cwd=/builds/worker/checkouts/vcs'
274                                     - '--'
275                                     - bash
276                                     - -cx
277                                     - $let:
278                                           extraArgs: {$if: 'tasks_for == "cron"', then: '${cron.quoted_args}', else: ''}
279                                       in:
280                                           $if: 'tasks_for == "action"'
281                                           then: >
282                                               cd /builds/worker/checkouts/vcs &&
283                                               ln -s /builds/worker/artifacts artifacts &&
284                                               ~/.local/bin/taskgraph action-callback
285                                           else: >
286                                               cd /builds/worker/checkouts/vcs &&
287                                               ln -s /builds/worker/artifacts artifacts &&
288                                               ~/.local/bin/taskgraph decision
289                                               --pushlog-id='0'
290                                               --pushdate='0'
291                                               --project='${project}'
292                                               --message=""
293                                               --owner='${ownerEmail}'
294                                               --level='${level}'
295                                               --base-repository="$MOBILE_BASE_REPOSITORY"
296                                               --base-ref="$MOBILE_BASE_REF"
297                                               --base-rev="$MOBILE_BASE_REV"
298                                               --head-repository="$MOBILE_HEAD_REPOSITORY"
299                                               --head-ref="$MOBILE_HEAD_REF"
300                                               --head-rev="$MOBILE_HEAD_REV"
301                                               --repository-type="$MOBILE_REPOSITORY_TYPE"
302                                               --tasks-for='${tasks_for}'
303                                               ${extraArgs}
305                                 artifacts:
306                                     'public':
307                                         type: 'directory'
308                                         path: '/builds/worker/artifacts'
309                                         expires: {$fromNow: '1 year'}
310                                     'public/docker-contexts':
311                                         type: 'directory'
312                                         path: '/builds/worker/checkouts/vcs/docker-contexts'
313                                         # This needs to be at least the deadline of the
314                                         # decision task + the docker-image task deadlines.
315                                         # It is set to a week to allow for some time for
316                                         # debugging, but they are not useful long-term.
317                                         expires: {$fromNow: '7 day'}
319                             extra:
320                                 $merge:
321                                     - treeherder:
322                                           $merge:
323                                               - machine:
324                                                     platform: gecko-decision
325                                               - $if: 'isPullRequest || tasks_for == "github-push"'
326                                                 then:
327                                                     symbol: D
328                                                 else:
329                                                     $if: 'tasks_for == "action"'
330                                                     then:
331                                                         groupName: 'action-callback'
332                                                         groupSymbol: AC
333                                                         symbol: "${action.symbol}"
334                                                     else:
335                                                         groupSymbol: cron
336                                                         symbol: "${cron.job_symbol}"
337                                     - $if: 'tasks_for == "action"'
338                                       then:
339                                           parent: '${action.taskGroupId}'
340                                           action:
341                                               name: '${action.name}'
342                                               context:
343                                                   taskGroupId: '${action.taskGroupId}'
344                                                   taskId: {$eval: 'taskId'}
345                                                   input: {$eval: 'input'}
346                                                   clientId: {$eval: 'clientId'}
347                                     - $if: 'tasks_for == "cron"'
348                                       then:
349                                           cron: {$json: {$eval: 'cron'}}
350                                     - tasks_for: '${tasks_for}'