Bug 1635304 [wpt PR 23392] - Remove erroneous named properties object test, a=testonly
[gecko.git] / .taskcluster.yml
blob54c9d8921cc2669b28477ca16babd15e56d573d5
1 # This file is rendered via JSON-e by
2 # - mozilla-taskcluster - See
3 #   https://docs.taskcluster.net/reference/integrations/mozilla-taskcluster/docs/taskcluster-yml
4 #   {
5 #     tasks_for: 'hg-push',
6 #     push: {owner, comment, pushlog_id, pushdate},
7 #     repository: {url, project, level},
8 #     now,
9 #     as_slugid: // function
10 #     ownTaskId: // taskId of the task that will be created
11 #   }
13 # - cron tasks - See taskcluster/taskgraph/cron/decision.py
14 #   {
15 #     tasks_for: 'cron',
16 #     push: {revision, pushlog_id, pushdate, owner}
17 #     repository: {url, project, level},
18 #     cron: {task_id, job_name, job_symbol, quoted_args},
19 #     now,
20 #     ownTaskId: // taskId of the task that will be created
21 #   }
23 # - action tasks - See:
24 #   * taskcluster/taskgraph/actions/registry.py,
25 #   * https://docs.taskcluster.net/docs/manual/using/actions/spec
26 #   * ci-admin:ciadmin/generate/in_tree_actions.py
28 #   The registry generates the hookPayload that appears in actions.json, and
29 #   contains data from the decision task as well as JSON-e code to combine that
30 #   with data supplied as part of the action spec.  When the hook is fired, the
31 #   hookPayload is rendered with JSON-e to produce a payload for the hook task
32 #   template.
34 #   The ci-admin code wraps the content of this file (.taskcluster.yml) with a
35 #   JSON-e $let statement that produces the context described below, and
36 #   installs that as the hook task template.
38 #   {
39 #     tasks_for: 'action',
40 #     push: {owner, pushlog_id, revision},
41 #     repository: {url, project, level},
42 #     input,
43 #     taskId,      // targetted taskId
44 #     taskGroupId, // targetted taskGroupId
45 #     action: {name, title, description, taskGroupId, symbol, repo_scope, cb_name}
46 #     ownTaskId:   // taskId of the task that will be created
47 #     clientId:    // clientId that triggered this hook
48 #   }
50 version: 1
51 tasks:
52   # NOTE: support for actions in ci-admin requires that the `tasks` property be an array *before* JSON-e rendering
53   # takes place.
54   - $if: 'tasks_for in ["hg-push", "action", "cron"]'
55     then:
56       $let:
57         # sometimes the push user is just `ffxbld` or the like, but we want an email-like field..
58         ownerEmail: {$if: '"@" in push.owner', then: '${push.owner}', else: '${push.owner}@noreply.mozilla.org'}
59         # ensure there's no trailing `/` on the repo URL
60         repoUrl: {$if: 'repository.url[-1] == "/"', then: {$eval: 'repository.url[:-1]'}, else: {$eval: 'repository.url'}}
61         # expire try earlier than other branches
62         expires:
63           $if: 'repository.project == "try"'
64           then: {$fromNow: '28 days'}
65           else: {$fromNow: '1 year'}
66         trust_domain: gecko
67       in:
68         taskId: {$if: 'tasks_for != "action"', then: '${ownTaskId}'}
69         taskGroupId:
70           $if: 'tasks_for == "action"'
71           then:
72             '${action.taskGroupId}'
73           else:
74             '${ownTaskId}' # same as taskId; this is how automation identifies a decision tsak
75         schedulerId: '${trust_domain}-level-${repository.level}'
77         created: {$fromNow: ''}
78         deadline: {$fromNow: '1 day'}
79         expires: {$eval: 'expires'}
80         metadata:
81           $merge:
82             - owner: "${ownerEmail}"
83               source: "${repoUrl}/raw-file/${push.revision}/.taskcluster.yml"
84             - $if: 'tasks_for == "hg-push"'
85               then:
86                 name: "Gecko Decision Task"
87                 description: 'The task that creates all of the other tasks in the task graph'
88               else:
89                 $if: 'tasks_for == "action"'
90                 then:
91                   name: "Action: ${action.title}"
92                   description: |
93                       ${action.description}
94                       
95                       Action triggered by clientID `${clientId}`
96                 else:
97                   name: "Decision Task for cron job ${cron.job_name}"
98                   description: 'Created by a [cron task](https://tools.taskcluster.net/tasks/${cron.task_id})'
100         provisionerId: "${trust_domain}-${repository.level}"
101         workerType: "decision"
103         tags:
104           $if: 'tasks_for == "hg-push"'
105           then:
106             createdForUser: "${ownerEmail}"
107             kind: decision-task
108           else:
109             $if: 'tasks_for == "action"'
110             then:
111               createdForUser: '${ownerEmail}'
112               kind: 'action-callback'
113             else:
114               $if: 'tasks_for == "cron"'
115               then:
116                 kind: cron-task
118         routes:
119           $flattenDeep:
120             - "tc-treeherder.v2.${repository.project}.${push.revision}.${push.pushlog_id}"
121             - $if: 'tasks_for == "hg-push"'
122               then:
123                 - "index.${trust_domain}.v2.${repository.project}.latest.taskgraph.decision"
124                 - "index.${trust_domain}.v2.${repository.project}.revision.${push.revision}.taskgraph.decision"
125                 - "index.${trust_domain}.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision"
126                 - "notify.email.${ownerEmail}.on-failed"
127                 - "notify.email.${ownerEmail}.on-exception"
128                 # Send a notification email if the push comes from try
129                 - $if: 'repository.project == "try"'
130                   then:
131                     "notify.email.${ownerEmail}.on-completed"
132               else:
133                 $if: 'tasks_for == "action"'
134                 then:
135                 - "index.${trust_domain}.v2.${repository.project}.revision.${push.revision}.taskgraph.actions.${ownTaskId}"
136                 - "index.${trust_domain}.v2.${repository.project}.pushlog-id.${push.pushlog_id}.actions.${ownTaskId}"
137                 else:  # cron
138                 - "index.${trust_domain}.v2.${repository.project}.latest.taskgraph.decision-${cron.job_name}"
139                 - "index.${trust_domain}.v2.${repository.project}.revision.${push.revision}.taskgraph.decision-${cron.job_name}"
140                 - "index.${trust_domain}.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision-${cron.job_name}"
141                 # list each cron task on this revision, so actions can find them
142                 - 'index.${trust_domain}.v2.${repository.project}.revision.${push.revision}.cron.${ownTaskId}'
143                 # BUG 1500166 Notify ciduty by email if a nightly hook fails
144                 - $if: 'repository.project != "try"'
145                   then:
146                   - "notify.email.ciduty+failedcron@mozilla.com.on-failed"
147                   - "notify.email.ciduty+exceptioncron@mozilla.com.on-exception"
148                   - "notify.email.sheriffs+failedcron@mozilla.org.on-failed"
149                   - "notify.email.sheriffs+exceptioncron@mozilla.org.on-exception"
151         scopes:
152           $if: 'tasks_for == "hg-push"'
153           then:
154             - 'assume:repo:${repoUrl[8:]}:branch:default'
155             - 'queue:route:notify.email.${ownerEmail}.*'
156             - 'in-tree:hook-action:project-${trust_domain}/in-tree-action-${repository.level}-*'
157           else:
158             $if: 'tasks_for == "action"'
159             then:
160               # when all actions are hooks, we can calculate this directly rather than using a variable
161               - '${action.repo_scope}'
162             else:
163               - 'assume:repo:${repoUrl[8:]}:cron:${cron.job_name}'
165         dependencies: []
166         requires: all-completed
168         priority:
169           # Most times, there is plenty of worker capacity so everything runs
170           # quickly, but sometimes a storm of action tasks lands.  Then we
171           # want, from highest to lowest:
172           # - cron tasks (time-sensitive) (low)
173           # - action tasks (avoid interfering with the other two) (very-low)
174           # - decision tasks (minimize user-visible delay) (lowest)
175           # SCM levels all use different workerTypes, so there is no need for priority
176           # between levels; "low" is the highest priority available at all levels, and
177           # nothing runs at any higher priority on these workerTypes.
178           $if: "tasks_for == 'cron'"
179           then: low
180           else:
181             $if: "tasks_for == 'action'"
182             then: very-low
183             else: lowest  # tasks_for == 'hg-push'
184         retries:
185           $if: "tasks_for == 'hg-push'"
186           then: 0
187           else: 5
189         payload:
190           env:
191             # checkout-gecko uses these to check out the source; the inputs
192             # to `mach taskgraph decision` are all on the command line.
193             $merge:
194               - GECKO_BASE_REPOSITORY: 'https://hg.mozilla.org/mozilla-unified'
195                 GECKO_HEAD_REPOSITORY: '${repoUrl}'
196                 GECKO_HEAD_REF: '${push.revision}'
197                 GECKO_HEAD_REV: '${push.revision}'
198                 HG_STORE_PATH: /builds/worker/checkouts/hg-store
199                 TASKCLUSTER_CACHES: /builds/worker/checkouts
200                 # mach generates pyc files when reading `mach_commands.py`
201                 # This causes cached_task digest generation to be random for
202                 # some tasks. Disable bytecode generation to work around that.
203                 PYTHONDONTWRITEBYTECODE: '1'
204                 # someday, these will be provided by the worker - Bug 1492664
205                 TASKCLUSTER_ROOT_URL: https://taskcluster.net
206                 TASKCLUSTER_PROXY_URL: http://taskcluster
207               - $if: 'tasks_for == "action"'
208                 then:
209                   ACTION_TASK_GROUP_ID: '${action.taskGroupId}'     # taskGroupId of the target task
210                   ACTION_TASK_ID: {$json: {$eval: 'taskId'}} # taskId of the target task (JSON-encoded)
211                   ACTION_INPUT: {$json: {$eval: 'input'}}
212                   ACTION_CALLBACK: '${action.cb_name}'
214           cache:
215             "${trust_domain}-level-${repository.level}-checkouts-sparse-v2": /builds/worker/checkouts
217           features:
218             taskclusterProxy: true
219             chainOfTrust: true
221           # Note: This task is built server side without the context or tooling that
222           # exist in tree so we must hard code the hash
223           image: 'taskcluster/decision:2.2.0@sha256:0e9689e94605eb8395f5b49141a48148416b0d825f6f7be04c29642d1a85ee3d'
225           maxRunTime: 1800
227           command:
228             - /builds/worker/bin/run-task
229             - '--gecko-checkout=/builds/worker/checkouts/gecko'
230             - '--gecko-sparse-profile=build/sparse-profiles/taskgraph'
231             - '--'
232             - bash
233             - -cx
234             - $let:
235                 extraArgs: {$if: 'tasks_for == "cron"', then: '${cron.quoted_args}', else: ''}
236               in:
237                 $if: 'tasks_for == "action"'
238                 then: >
239                   cd /builds/worker/checkouts/gecko &&
240                   ln -s /builds/worker/artifacts artifacts &&
241                   ./mach --log-no-times taskgraph action-callback
242                 else: >
243                   cd /builds/worker/checkouts/gecko &&
244                   ln -s /builds/worker/artifacts artifacts &&
245                   ./mach --log-no-times taskgraph decision
246                   --pushlog-id='${push.pushlog_id}'
247                   --pushdate='${push.pushdate}'
248                   --project='${repository.project}'
249                   --owner='${ownerEmail}'
250                   --level='${repository.level}'
251                   --tasks-for='${tasks_for}'
252                   --base-repository="$GECKO_BASE_REPOSITORY"
253                   --head-repository="$GECKO_HEAD_REPOSITORY"
254                   --head-ref="$GECKO_HEAD_REF"
255                   --head-rev="$GECKO_HEAD_REV"
256                   ${extraArgs}
258           artifacts:
259             'public':
260               type: 'directory'
261               path: '/builds/worker/artifacts'
262               expires: {$eval: expires}
264         extra:
265           $merge:
266             - treeherder:
267                 $merge:
268                   - machine:
269                       platform: gecko-decision
270                   - $if: 'tasks_for == "hg-push"'
271                     then:
272                       symbol: D
273                     else:
274                       $if: 'tasks_for == "action"'
275                       then:
276                         groupName: 'action-callback'
277                         groupSymbol: AC
278                         symbol: "${action.symbol}"
279                       else:
280                         groupSymbol: cron
281                         symbol: "${cron.job_symbol}"
282             - $if: 'tasks_for == "action"'
283               then:
284                 parent: '${action.taskGroupId}'
285                 action:
286                   name: '${action.name}'
287                   context:
288                     taskGroupId: '${action.taskGroupId}'
289                     taskId: {$eval: 'taskId'}
290                     input: {$eval: 'input'}
291                     clientId: {$eval: 'clientId'}
292             - $if: 'tasks_for == "cron"'
293               then:
294                 cron: {$json: {$eval: 'cron'}}
295             - tasks_for: '${tasks_for}'
296             # Email for all pushes should link to treeherder
297             - $if: 'tasks_for == "hg-push"'
298               then:
299                 notify:
300                   email:
301                     $merge:
302                       - link:
303                           text: "Treeherder Jobs"
304                           href: "https://treeherder.mozilla.org/#/jobs?repo=${repository.project}&revision=${push.revision}"
305                       # Email for try pushes should thank you for your revision
306                       - $if: 'repository.project == "try"'
307                         then:
308                           subject: "Thank you for your try submission of ${push.revision}. It's the best!"
309                           content: "Your try push has been submitted. It's the best! Use the link to view the status of your jobs."