Bug 1492664 - update funsize scripts to use TASKCLUSTER_ROOT_URL; r=sfraser
[gecko.git] / .taskcluster.yml
blob78e6be5a16d15b0c6fa49f328d99c5862429ac15
1 # This file is rendered via JSON-e by
2 # - mozilla-taskcluster - https://docs.taskcluster.net/reference/integrations/mozilla-taskcluster/docs/taskcluster-yml
3 # - cron tasks - taskcluster/taskgraph/cron/decision.py
4 # - action tasks - taskcluster/taskgraph/actions/registry.py
5 version: 1
6 tasks:
7   # NOTE: support for actions in ci-admin requires that the `tasks` property be an array *before* JSON-e rendering
8   # takes place.
9   - $if: 'tasks_for in ["hg-push", "action", "cron"]'
10     then:
11       $let:
12         # sometimes the push user is just `ffxbld` or the like, but we want an email-like field..
13         ownerEmail: {$if: '"@" in push.owner', then: '${push.owner}', else: '${push.owner}@noreply.mozilla.org'}
14         # ensure there's no trailing `/` on the repo URL
15         repoUrl: {$if: 'repository.url[-1] == "/"', then: {$eval: 'repository.url[:-1]'}, else: {$eval: 'repository.url'}}
16       in:
17         taskId: {$if: 'tasks_for != "action"', then: '${as_slugid("decision")}'}
18         taskGroupId:
19           $if: 'tasks_for == "action"'
20           then:
21             '${action.taskGroupId}'
22           else:
23             '${as_slugid("decision")}' # same as taskId; this is how automation identifies a decision tsak
24         schedulerId: 'gecko-level-${repository.level}'
26         created: {$fromNow: ''}
27         deadline: {$fromNow: '1 day'}
28         expires: {$fromNow: '1 year 1 second'} # 1 second so artifacts expire first, despite rounding errors
29         metadata:
30           $merge:
31             - owner: "${ownerEmail}"
32               source: "${repoUrl}/raw-file/${push.revision}/.taskcluster.yml"
33             - $if: 'tasks_for == "hg-push"'
34               then:
35                 name: "Gecko Decision Task"
36                 description: 'The task that creates all of the other tasks in the task graph'
37               else:
38                 $if: 'tasks_for == "action"'
39                 then:
40                   name: "Action: ${action.title}"
41                   description: '${action.description}'
42                 else:
43                   name: "Decision Task for cron job ${cron.job_name}"
44                   description: 'Created by a [cron task](https://tools.taskcluster.net/tasks/${cron.task_id})'
46         provisionerId: "aws-provisioner-v1"
47         workerType: "gecko-${repository.level}-decision"
49         tags:
50           $if: 'tasks_for == "hg-push"'
51           then:
52             createdForUser: "${ownerEmail}"
53             kind: decision-task
54           else:
55             $if: 'tasks_for == "action"'
56             then:
57               createdForUser: '${ownerEmail}'
58               kind: 'action-callback'
59             else:
60               $if: 'tasks_for == "cron"'
61               then:
62                 kind: cron-task
64         routes:
65           $flatten:
66             - "tc-treeherder.v2.${repository.project}.${push.revision}.${push.pushlog_id}"
67             - $if: 'tasks_for == "hg-push"'
68               then:
69                 - "index.gecko.v2.${repository.project}.latest.taskgraph.decision"
70                 - "index.gecko.v2.${repository.project}.revision.${push.revision}.taskgraph.decision"
71                 - "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision"
72                 - "notify.email.${ownerEmail}.on-failed"
73                 - "notify.email.${ownerEmail}.on-exception"
74                 # Send a notification email if the push comes from try
75                 - $if: 'repository.project == "try"'
76                   then:
77                     "notify.email.${ownerEmail}.on-completed"
78                 # These are the old index routes for the decision task.
79                 # They are still here so external tools that referenced them continue to work.
80                 - "index.gecko.v2.${repository.project}.latest.firefox.decision"
81                 - "index.gecko.v2.${repository.project}.revision.${push.revision}.firefox.decision"
82               else:
83                 $if: 'tasks_for == "action"'
84                 then:
85                 - "notify.email.taskcluster-notifications+action-task@mozilla.com.on-failed"
86                 - "notify.email.taskcluster-notifications+action-task@mozilla.com.on-exception"
87                 - "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.actions.${ownTaskId}"
88                 else:  # cron
89                 - "index.gecko.v2.${repository.project}.latest.taskgraph.decision-${cron.job_name}"
90                 - "index.gecko.v2.${repository.project}.revision.${push.revision}.taskgraph.decision-${cron.job_name}"
91                 - "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision-${cron.job_name}"
92                 # list each cron task on this revision, so actions can find them
93                 - 'index.gecko.v2.${repository.project}.revision.${push.revision}.cron.${as_slugid("decision")}'
94                 # BUG 1500166 Notify ciduty by email if a nightly hook fails
95                 - "notify.email.ciduty+failedcron@mozilla.com.on-failed"
96                 - "notify.email.ciduty+exceptioncron@mozilla.com.on-exception"
97                 - "notify.email.sheriffs+failedcron@mozilla.org.on-failed"
98                 - "notify.email.sheriffs+exceptioncron@mozilla.org.on-exception"
99                 # These are the old index routes for the decision task.
100                 - "index.gecko.v2.${repository.project}.latest.firefox.decision-${cron.job_name}"
102         scopes:
103           $if: 'tasks_for == "hg-push"'
104           then:
105             - 'assume:repo:${repoUrl[8:]}:branch:default'
106             - 'queue:route:notify.email.${ownerEmail}.*'
107             - 'in-tree:hook-action:project-gecko/in-tree-action-${repository.level}-*'
108           else:
109             $if: 'tasks_for == "action"'
110             then:
111               # when all actions are hooks, we can calculate this directly rather than using a variable
112               - '${action.repo_scope}'
113             else:
114               - 'assume:repo:${repoUrl[8:]}:cron:${cron.job_name}'
116         dependencies: []
117         requires: all-completed
119         priority:
120           # Most times, there is plenty of worker capacity so everything runs
121           # quickly, but sometimes a storm of action tasks lands.  Then we
122           # want, from highest to lowest:
123           # - cron tasks (time-sensitive) (low)
124           # - action tasks (avoid interfering with the other two) (very-low)
125           # - decision tasks (minimize user-visible delay) (lowest)
126           # SCM levels all use different workerTypes, so there is no need for priority
127           # between levels; "low" is the highest priority available at all levels, and
128           # nothing runs at any higher priority on these workerTypes.
129           $if: "tasks_for == 'cron'"
130           then: low
131           else:
132             $if: "tasks_for == 'action'"
133             then: very-low
134             else: lowest  # tasks_for == 'hg-push'
135         retries: 5
137         payload:
138           env:
139             # checkout-gecko uses these to check out the source; the inputs
140             # to `mach taskgraph decision` are all on the command line.
141             $merge:
142               - GECKO_BASE_REPOSITORY: 'https://hg.mozilla.org/mozilla-unified'
143                 GECKO_HEAD_REPOSITORY: '${repoUrl}'
144                 GECKO_HEAD_REF: '${push.revision}'
145                 GECKO_HEAD_REV: '${push.revision}'
146                 GECKO_COMMIT_MSG: {$if: 'tasks_for != "action"', then: '${push.comment}'}
147                 HG_STORE_PATH: /builds/worker/checkouts/hg-store
148                 TASKCLUSTER_CACHES: /builds/worker/checkouts
149                 # someday, these will be provided by the worker - Bug 1492664
150                 TASKCLUSTER_ROOT_URL: https://taskcluster.net
151                 TASKCLUSTER_PROXY_URL: http://taskcluster
152               - $if: 'tasks_for == "action"'
153                 then:
154                   ACTION_TASK_GROUP_ID: '${action.taskGroupId}'     # taskGroupId of the target task
155                   ACTION_TASK_ID: {$json: {$eval: 'taskId'}} # taskId of the target task (JSON-encoded)
156                   ACTION_INPUT: {$json: {$eval: 'input'}}
157                   ACTION_CALLBACK: '${action.cb_name}'
158                   ACTION_PARAMETERS: {$json: {$eval: 'parameters'}}
160           cache:
161             level-${repository.level}-checkouts-sparse-v2: /builds/worker/checkouts
163           features:
164             taskclusterProxy: true
165             chainOfTrust: true
167           # Note: This task is built server side without the context or tooling that
168           # exist in tree so we must hard code the hash
169           image: 'taskcluster/decision:2.1.0@sha256:6db3b697d7a3c7aba440d72f04199331b872111cefff57206b8b8b1d53230360'
171           maxRunTime: 1800
173           command:
174             - /builds/worker/bin/run-task
175             - '--vcs-checkout=/builds/worker/checkouts/gecko'
176             - '--sparse-profile=build/sparse-profiles/taskgraph'
177             - '--'
178             - bash
179             - -cx
180             - $let:
181                 extraArgs: {$if: 'tasks_for == "cron"', then: '${cron.quoted_args}', else: ''}
182               in:
183                 $if: 'tasks_for == "action"'
184                 then: >
185                   cd /builds/worker/checkouts/gecko &&
186                   ln -s /builds/worker/artifacts artifacts &&
187                   ./mach --log-no-times taskgraph action-callback
188                 else: >
189                   cd /builds/worker/checkouts/gecko &&
190                   ln -s /builds/worker/artifacts artifacts &&
191                   ./mach --log-no-times taskgraph decision
192                   --pushlog-id='${push.pushlog_id}'
193                   --pushdate='${push.pushdate}'
194                   --project='${repository.project}'
195                   --message="$GECKO_COMMIT_MSG"
196                   --owner='${ownerEmail}'
197                   --level='${repository.level}'
198                   --base-repository="$GECKO_BASE_REPOSITORY"
199                   --head-repository="$GECKO_HEAD_REPOSITORY"
200                   --head-ref="$GECKO_HEAD_REF"
201                   --head-rev="$GECKO_HEAD_REV"
202                   ${extraArgs}
204           artifacts:
205             'public':
206               type: 'directory'
207               path: '/builds/worker/artifacts'
208               expires: {$fromNow: '1 year'}
210         extra:
211           $merge:
212             - treeherder:
213                 $merge:
214                   - machine:
215                       platform: gecko-decision
216                   - $if: 'tasks_for == "hg-push"'
217                     then:
218                       symbol: D
219                     else:
220                       $if: 'tasks_for == "action"'
221                       then:
222                         groupName: 'action-callback'
223                         groupSymbol: AC
224                         symbol: "${action.symbol}"
225                       else:
226                         groupSymbol: cron
227                         symbol: "${cron.job_symbol}"
228             - $if: 'tasks_for == "action"'
229               then:
230                 parent: '${action.taskGroupId}'
231                 action:
232                   name: '${action.name}'
233                   context:
234                     taskGroupId: '${action.taskGroupId}'
235                     taskId: {$eval: 'taskId'}
236                     input: {$eval: 'input'}
237                     parameters: {$eval: 'parameters'}
238             - $if: 'tasks_for == "cron"'
239               then:
240                 cron: {$json: {$eval: 'cron'}}
241             - tasks_for: '${tasks_for}'
242             # Email format for try pushes
243             - $if: 'tasks_for == "hg-push" && repository.project == "try"'
244               then:
245                 notify:
246                   email:
247                     subject: "Thank you for your try submission of ${push.revision}. It's the best!"
248                     content: "Your try push has been submitted. It's the best! Use the link to view the status of your jobs."
249                     link:
250                       text: "Treeherder Jobs"
251                       href: "https://treeherder.mozilla.org/#/jobs?repo=${repository.project}&revision=${push.revision}"