Bug 1540028 [wpt PR 16099] - Catch more exceptions in Document-createElement-namespac...
[gecko.git] / .taskcluster.yml
blob1759d3806b7b31eaaab95c811daa776a641ab8fa
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 #     parameters,
44 #     taskId,      // targetted taskId
45 #     taskGroupId, // targetted taskGroupId
46 #     action: {name, title, description, taskGroupId, symbol, repo_scope, cb_name}
47 #     ownTaskId:   // taskId of the task that will be created
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       in:
62         taskId: {$if: 'tasks_for != "action"', then: '${ownTaskId}'}
63         taskGroupId:
64           $if: 'tasks_for == "action"'
65           then:
66             '${action.taskGroupId}'
67           else:
68             '${ownTaskId}' # same as taskId; this is how automation identifies a decision tsak
69         schedulerId: 'gecko-level-${repository.level}'
71         created: {$fromNow: ''}
72         deadline: {$fromNow: '1 day'}
73         expires: {$fromNow: '1 year 1 second'} # 1 second so artifacts expire first, despite rounding errors
74         metadata:
75           $merge:
76             - owner: "${ownerEmail}"
77               source: "${repoUrl}/raw-file/${push.revision}/.taskcluster.yml"
78             - $if: 'tasks_for == "hg-push"'
79               then:
80                 name: "Gecko Decision Task"
81                 description: 'The task that creates all of the other tasks in the task graph'
82               else:
83                 $if: 'tasks_for == "action"'
84                 then:
85                   name: "Action: ${action.title}"
86                   description: |
87                       ${action.description}
88                       
89                       Action triggered by clientID `${clientId}`
90                 else:
91                   name: "Decision Task for cron job ${cron.job_name}"
92                   description: 'Created by a [cron task](https://tools.taskcluster.net/tasks/${cron.task_id})'
94         provisionerId: "aws-provisioner-v1"
95         workerType: "gecko-${repository.level}-decision"
97         tags:
98           $if: 'tasks_for == "hg-push"'
99           then:
100             createdForUser: "${ownerEmail}"
101             kind: decision-task
102           else:
103             $if: 'tasks_for == "action"'
104             then:
105               createdForUser: '${ownerEmail}'
106               kind: 'action-callback'
107             else:
108               $if: 'tasks_for == "cron"'
109               then:
110                 kind: cron-task
112         routes:
113           $flattenDeep:
114             - "tc-treeherder.v2.${repository.project}.${push.revision}.${push.pushlog_id}"
115             - $if: 'tasks_for == "hg-push"'
116               then:
117                 - "index.gecko.v2.${repository.project}.latest.taskgraph.decision"
118                 - "index.gecko.v2.${repository.project}.revision.${push.revision}.taskgraph.decision"
119                 - "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision"
120                 - "notify.email.${ownerEmail}.on-failed"
121                 - "notify.email.${ownerEmail}.on-exception"
122                 # Send a notification email if the push comes from try
123                 - $if: 'repository.project == "try"'
124                   then:
125                     "notify.email.${ownerEmail}.on-completed"
126                 # These are the old index routes for the decision task.
127                 # They are still here so external tools that referenced them continue to work.
128                 - "index.gecko.v2.${repository.project}.latest.firefox.decision"
129                 - "index.gecko.v2.${repository.project}.revision.${push.revision}.firefox.decision"
130               else:
131                 $if: 'tasks_for == "action"'
132                 then:
133                 - "notify.email.taskcluster-notifications+action-task@mozilla.com.on-failed"
134                 - "notify.email.taskcluster-notifications+action-task@mozilla.com.on-exception"
135                 - "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.actions.${ownTaskId}"
136                 else:  # cron
137                 - "index.gecko.v2.${repository.project}.latest.taskgraph.decision-${cron.job_name}"
138                 - "index.gecko.v2.${repository.project}.revision.${push.revision}.taskgraph.decision-${cron.job_name}"
139                 - "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision-${cron.job_name}"
140                 # list each cron task on this revision, so actions can find them
141                 - 'index.gecko.v2.${repository.project}.revision.${push.revision}.cron.${ownTaskId}'
142                 # BUG 1500166 Notify ciduty by email if a nightly hook fails
143                 - $if: 'repository.project != "try"'
144                   then:
145                   - "notify.email.ciduty+failedcron@mozilla.com.on-failed"
146                   - "notify.email.ciduty+exceptioncron@mozilla.com.on-exception"
147                   - "notify.email.sheriffs+failedcron@mozilla.org.on-failed"
148                   - "notify.email.sheriffs+exceptioncron@mozilla.org.on-exception"
149                 # These are the old index routes for the decision task.
150                 - "index.gecko.v2.${repository.project}.latest.firefox.decision-${cron.job_name}"
152         scopes:
153           $if: 'tasks_for == "hg-push"'
154           then:
155             - 'assume:repo:${repoUrl[8:]}:branch:default'
156             - 'queue:route:notify.email.${ownerEmail}.*'
157             - 'in-tree:hook-action:project-gecko/in-tree-action-${repository.level}-*'
158           else:
159             $if: 'tasks_for == "action"'
160             then:
161               # when all actions are hooks, we can calculate this directly rather than using a variable
162               - '${action.repo_scope}'
163             else:
164               - 'assume:repo:${repoUrl[8:]}:cron:${cron.job_name}'
166         dependencies: []
167         requires: all-completed
169         priority:
170           # Most times, there is plenty of worker capacity so everything runs
171           # quickly, but sometimes a storm of action tasks lands.  Then we
172           # want, from highest to lowest:
173           # - cron tasks (time-sensitive) (low)
174           # - action tasks (avoid interfering with the other two) (very-low)
175           # - decision tasks (minimize user-visible delay) (lowest)
176           # SCM levels all use different workerTypes, so there is no need for priority
177           # between levels; "low" is the highest priority available at all levels, and
178           # nothing runs at any higher priority on these workerTypes.
179           $if: "tasks_for == 'cron'"
180           then: low
181           else:
182             $if: "tasks_for == 'action'"
183             then: very-low
184             else: lowest  # tasks_for == 'hg-push'
185         retries: 5
187         payload:
188           env:
189             # checkout-gecko uses these to check out the source; the inputs
190             # to `mach taskgraph decision` are all on the command line.
191             $merge:
192               - GECKO_BASE_REPOSITORY: 'https://hg.mozilla.org/mozilla-unified'
193                 GECKO_HEAD_REPOSITORY: '${repoUrl}'
194                 GECKO_HEAD_REF: '${push.revision}'
195                 GECKO_HEAD_REV: '${push.revision}'
196                 HG_STORE_PATH: /builds/worker/checkouts/hg-store
197                 TASKCLUSTER_CACHES: /builds/worker/checkouts
198                 # someday, these will be provided by the worker - Bug 1492664
199                 TASKCLUSTER_ROOT_URL: https://taskcluster.net
200                 TASKCLUSTER_PROXY_URL: http://taskcluster
201               - $if: 'tasks_for == "action"'
202                 then:
203                   ACTION_TASK_GROUP_ID: '${action.taskGroupId}'     # taskGroupId of the target task
204                   ACTION_TASK_ID: {$json: {$eval: 'taskId'}} # taskId of the target task (JSON-encoded)
205                   ACTION_INPUT: {$json: {$eval: 'input'}}
206                   ACTION_CALLBACK: '${action.cb_name}'
207                   ACTION_PARAMETERS: {$json: {$eval: 'parameters'}}
209           cache:
210             level-${repository.level}-checkouts-sparse-v2: /builds/worker/checkouts
212           features:
213             taskclusterProxy: true
214             chainOfTrust: true
216           # Note: This task is built server side without the context or tooling that
217           # exist in tree so we must hard code the hash
218           image: 'taskcluster/decision:2.2.0@sha256:0e9689e94605eb8395f5b49141a48148416b0d825f6f7be04c29642d1a85ee3d'
220           maxRunTime: 1800
222           command:
223             - /builds/worker/bin/run-task
224             - '--gecko-checkout=/builds/worker/checkouts/gecko'
225             - '--gecko-sparse-profile=build/sparse-profiles/taskgraph'
226             - '--'
227             - bash
228             - -cx
229             - $let:
230                 extraArgs: {$if: 'tasks_for == "cron"', then: '${cron.quoted_args}', else: ''}
231               in:
232                 $if: 'tasks_for == "action"'
233                 then: >
234                   cd /builds/worker/checkouts/gecko &&
235                   ln -s /builds/worker/artifacts artifacts &&
236                   ./mach --log-no-times taskgraph action-callback
237                 else: >
238                   cd /builds/worker/checkouts/gecko &&
239                   ln -s /builds/worker/artifacts artifacts &&
240                   ./mach --log-no-times taskgraph decision
241                   --pushlog-id='${push.pushlog_id}'
242                   --pushdate='${push.pushdate}'
243                   --project='${repository.project}'
244                   --owner='${ownerEmail}'
245                   --level='${repository.level}'
246                   --tasks-for='${tasks_for}'
247                   --base-repository="$GECKO_BASE_REPOSITORY"
248                   --head-repository="$GECKO_HEAD_REPOSITORY"
249                   --head-ref="$GECKO_HEAD_REF"
250                   --head-rev="$GECKO_HEAD_REV"
251                   ${extraArgs}
253           artifacts:
254             'public':
255               type: 'directory'
256               path: '/builds/worker/artifacts'
257               expires: {$fromNow: '1 year'}
259         extra:
260           $merge:
261             - treeherder:
262                 $merge:
263                   - machine:
264                       platform: gecko-decision
265                   - $if: 'tasks_for == "hg-push"'
266                     then:
267                       symbol: D
268                     else:
269                       $if: 'tasks_for == "action"'
270                       then:
271                         groupName: 'action-callback'
272                         groupSymbol: AC
273                         symbol: "${action.symbol}"
274                       else:
275                         groupSymbol: cron
276                         symbol: "${cron.job_symbol}"
277             - $if: 'tasks_for == "action"'
278               then:
279                 parent: '${action.taskGroupId}'
280                 action:
281                   name: '${action.name}'
282                   context:
283                     taskGroupId: '${action.taskGroupId}'
284                     taskId: {$eval: 'taskId'}
285                     input: {$eval: 'input'}
286                     parameters: {$eval: 'parameters'}
287                     clientId: {$eval: 'clientId'}
288             - $if: 'tasks_for == "cron"'
289               then:
290                 cron: {$json: {$eval: 'cron'}}
291             - tasks_for: '${tasks_for}'
292             # Email format for try pushes
293             - $if: 'tasks_for == "hg-push" && repository.project == "try"'
294               then:
295                 notify:
296                   email:
297                     subject: "Thank you for your try submission of ${push.revision}. It's the best!"
298                     content: "Your try push has been submitted. It's the best! Use the link to view the status of your jobs."
299                     link:
300                       text: "Treeherder Jobs"
301                       href: "https://treeherder.mozilla.org/#/jobs?repo=${repository.project}&revision=${push.revision}"