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
7 # NOTE: support for actions in ci-admin requires that the `tasks` property be an array *before* JSON-e rendering
9 - $if: 'tasks_for in ["hg-push", "action", "cron"]'
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'}}
17 taskId: {$if: 'tasks_for != "action"', then: '${as_slugid("decision")}'}
19 $if: 'tasks_for == "action"'
21 '${action.taskGroupId}'
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
31 - owner: "${ownerEmail}"
32 source: "${repoUrl}/raw-file/${push.revision}/.taskcluster.yml"
33 - $if: 'tasks_for == "hg-push"'
35 name: "Gecko Decision Task"
36 description: 'The task that creates all of the other tasks in the task graph'
38 $if: 'tasks_for == "action"'
40 name: "Action: ${action.title}"
41 description: '${action.description}'
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"
50 $if: 'tasks_for == "hg-push"'
52 createdForUser: "${ownerEmail}"
55 $if: 'tasks_for == "action"'
57 createdForUser: '${ownerEmail}'
58 kind: 'action-callback'
60 $if: 'tasks_for == "cron"'
66 - "tc-treeherder.v2.${repository.project}.${push.revision}.${push.pushlog_id}"
67 - $if: 'tasks_for == "hg-push"'
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"'
77 "notify.email.${ownerEmail}.on-completed"
78 # BUG 1500166 Notify ciduty by email if a nightly hook fails
79 - "notify.email.ciduty+failedcron@mozilla.com.on-failed"
80 - "notify.email.ciduty+exceptioncron@mozilla.com.on-exception"
81 - "notify.email.sheriffs+failedcron@mozilla.com.on-failed"
82 - "notify.email.sheriffs+exceptioncron@mozilla.com.on-exception"
83 # These are the old index routes for the decision task.
84 # They are still here so external tools that referenced them continue to work.
85 - "index.gecko.v2.${repository.project}.latest.firefox.decision"
86 - "index.gecko.v2.${repository.project}.revision.${push.revision}.firefox.decision"
88 $if: 'tasks_for == "action"'
90 - "notify.email.taskcluster-notifications+action-task@mozilla.com.on-failed"
91 - "notify.email.taskcluster-notifications+action-task@mozilla.com.on-exception"
92 - "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.actions.${ownTaskId}"
94 - "index.gecko.v2.${repository.project}.latest.taskgraph.decision-${cron.job_name}"
95 - "index.gecko.v2.${repository.project}.revision.${push.revision}.taskgraph.decision-${cron.job_name}"
96 - "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision-${cron.job_name}"
97 # list each cron task on this revision, so actions can find them
98 - 'index.gecko.v2.${repository.project}.revision.${push.revision}.cron.${as_slugid("decision")}'
99 # These are the old index routes for the decision task.
100 - "index.gecko.v2.${repository.project}.latest.firefox.decision-${cron.job_name}"
103 $if: 'tasks_for == "hg-push"'
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}-*'
109 $if: 'tasks_for == "action"'
111 # when all actions are hooks, we can calculate this directly rather than using a variable
112 - '${action.repo_scope}'
114 - 'assume:repo:${repoUrl[8:]}:cron:${cron.job_name}'
117 requires: all-completed
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'"
132 $if: "tasks_for == 'action'"
134 else: lowest # tasks_for == 'hg-push'
139 # checkout-gecko uses these to check out the source; the inputs
140 # to `mach taskgraph decision` are all on the command line.
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"'
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'}}
161 level-${repository.level}-checkouts-sparse-v2: /builds/worker/checkouts
164 taskclusterProxy: 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'
174 - /builds/worker/bin/run-task
175 - '--vcs-checkout=/builds/worker/checkouts/gecko'
176 - '--sparse-profile=build/sparse-profiles/taskgraph'
181 extraArgs: {$if: 'tasks_for == "cron"', then: '${cron.quoted_args}', else: ''}
183 $if: 'tasks_for == "action"'
185 cd /builds/worker/checkouts/gecko &&
186 ln -s /builds/worker/artifacts artifacts &&
187 ./mach --log-no-times taskgraph action-callback
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"
207 path: '/builds/worker/artifacts'
208 expires: {$fromNow: '1 year'}
215 platform: gecko-decision
216 - $if: 'tasks_for == "hg-push"'
220 $if: 'tasks_for == "action"'
222 groupName: 'action-callback'
224 symbol: "${action.symbol}"
227 symbol: "${cron.job_symbol}"
228 - $if: 'tasks_for == "action"'
230 parent: '${action.taskGroupId}'
232 name: '${action.name}'
234 taskGroupId: '${action.taskGroupId}'
235 taskId: {$eval: 'taskId'}
236 input: {$eval: 'input'}
237 parameters: {$eval: 'parameters'}
238 - $if: 'tasks_for == "cron"'
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"'
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."
250 text: "Treeherder Jobs"
251 href: "https://treeherder.mozilla.org/#/jobs?repo=${repository.project}&revision=${push.revision}"