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'}}
16 # Hardcode cron push info for now, so that we can transition to using real values without breaking callers of Chain of Trust
17 _pushId: {$if: 'tasks_for == "cron"', then: '-1', else: {$eval: 'push.pushlog_id'}}
18 # action tasks can fail because of no pushdate or push comment information in context, so include them in
19 # hardcodes (even though they don't use these variables)
20 _pushDate: {$if: 'tasks_for == "cron" || tasks_for == "action"', then: '0', else: {$eval: 'push.pushdate'}}
21 _pushComment: {$if: 'tasks_for == "cron" || tasks_for == "action"', then: '', else: {$eval: 'push.comment'}}
23 taskId: {$if: 'tasks_for != "action"', then: '${as_slugid("decision")}'}
25 $if: 'tasks_for == "action"'
27 '${action.taskGroupId}'
29 '${as_slugid("decision")}' # same as taskId; this is how automation identifies a decision tsak
30 schedulerId: 'gecko-level-${repository.level}'
32 created: {$fromNow: ''}
33 deadline: {$fromNow: '1 day'}
34 expires: {$fromNow: '1 year 1 second'} # 1 second so artifacts expire first, despite rounding errors
37 - owner: "${ownerEmail}"
38 source: "${repoUrl}/raw-file/${push.revision}/.taskcluster.yml"
39 - $if: 'tasks_for == "hg-push"'
41 name: "Gecko Decision Task"
42 description: 'The task that creates all of the other tasks in the task graph'
44 $if: 'tasks_for == "action"'
46 name: "Action: ${action.title}"
47 description: '${action.description}'
49 name: "Decision Task for cron job ${cron.job_name}"
50 description: 'Created by a [cron task](https://tools.taskcluster.net/tasks/${cron.task_id})'
52 provisionerId: "aws-provisioner-v1"
53 workerType: "gecko-${repository.level}-decision"
56 $if: 'tasks_for == "hg-push"'
58 createdForUser: "${ownerEmail}"
61 $if: 'tasks_for == "action"'
63 createdForUser: '${ownerEmail}'
64 kind: 'action-callback'
66 $if: 'tasks_for == "cron"'
72 - "tc-treeherder.v2.${repository.project}.${push.revision}.${_pushId}"
73 - $if: 'tasks_for == "hg-push"'
75 - "index.gecko.v2.${repository.project}.latest.taskgraph.decision"
76 - "index.gecko.v2.${repository.project}.revision.${push.revision}.taskgraph.decision"
77 - "index.gecko.v2.${repository.project}.pushlog-id.${_pushId}.decision"
78 - "notify.email.${ownerEmail}.on-failed"
79 - "notify.email.${ownerEmail}.on-exception"
80 # Send a notification email if the push comes from try
81 - $if: 'repository.project == "try"'
83 "notify.email.${ownerEmail}.on-completed"
84 # BUG 1500166 Notify ciduty by email if a nightly hook fails
85 - "notify.email.ciduty+failedcron@mozilla.com.on-failed"
86 - "notify.email.ciduty+exceptioncron@mozilla.com.on-exception"
87 - "notify.email.sheriffs+failedcron@mozilla.com.on-failed"
88 - "notify.email.sheriffs+exceptioncron@mozilla.com.on-exception"
89 # These are the old index routes for the decision task.
90 # They are still here so external tools that referenced them continue to work.
91 - "index.gecko.v2.${repository.project}.latest.firefox.decision"
92 - "index.gecko.v2.${repository.project}.revision.${push.revision}.firefox.decision"
94 $if: 'tasks_for == "action"'
96 - "notify.email.taskcluster-notifications+action-task@mozilla.com.on-failed"
97 - "notify.email.taskcluster-notifications+action-task@mozilla.com.on-exception"
98 - "index.gecko.v2.${repository.project}.pushlog-id.${_pushId}.actions.${ownTaskId}"
100 - "index.gecko.v2.${repository.project}.latest.taskgraph.decision-${cron.job_name}"
101 # list each cron task on this revision, so actions can find them
102 - 'index.gecko.v2.${repository.project}.revision.${push.revision}.cron.${as_slugid("decision")}'
103 # These are the old index routes for the decision task.
104 - "index.gecko.v2.${repository.project}.latest.firefox.decision-${cron.job_name}"
107 $if: 'tasks_for == "hg-push"'
109 - 'assume:repo:${repoUrl[8:]}:branch:default'
110 - 'queue:route:notify.email.${ownerEmail}.*'
111 - 'in-tree:hook-action:project-gecko/in-tree-action-${repository.level}-*'
113 $if: 'tasks_for == "action"'
115 # when all actions are hooks, we can calculate this directly rather than using a variable
116 - '${action.repo_scope}'
118 - 'assume:repo:${repoUrl[8:]}:cron:${cron.job_name}'
121 requires: all-completed
124 # Most times, there is plenty of worker capacity so everything runs
125 # quickly, but sometimes a storm of action tasks lands. Then we
126 # want, from highest to lowest:
127 # - cron tasks (time-sensitive) (low)
128 # - decision tasks (minimize user-visible delay) (very-low)
129 # - action tasks (avoid interfering with the other two) (lowest)
130 # SCM levels all use different workerTypes, so there is no need for priority
131 # between levels; "low" is the highest priority available at all levels, and
132 # nothing runs at any higher priority on these workerTypes.
133 $if: "tasks_for == 'cron'"
136 $if: "tasks_for == 'hg-push'"
138 else: lowest # tasks_for == 'action'
143 # checkout-gecko uses these to check out the source; the inputs
144 # to `mach taskgraph decision` are all on the command line.
146 - GECKO_BASE_REPOSITORY: 'https://hg.mozilla.org/mozilla-unified'
147 GECKO_HEAD_REPOSITORY: '${repoUrl}'
148 GECKO_HEAD_REF: '${push.revision}'
149 GECKO_HEAD_REV: '${push.revision}'
150 GECKO_COMMIT_MSG: {$if: 'tasks_for != "action"', then: '${_pushComment}'}
151 HG_STORE_PATH: /builds/worker/checkouts/hg-store
152 TASKCLUSTER_CACHES: /builds/worker/checkouts
153 - $if: 'tasks_for == "action"'
155 ACTION_TASK_GROUP_ID: '${action.taskGroupId}' # taskGroupId of the target task
156 ACTION_TASK_ID: {$json: {$eval: 'taskId'}} # taskId of the target task (JSON-encoded)
157 ACTION_INPUT: {$json: {$eval: 'input'}}
158 ACTION_CALLBACK: '${action.cb_name}'
159 ACTION_PARAMETERS: {$json: {$eval: 'parameters'}}
162 level-${repository.level}-checkouts-sparse-v2: /builds/worker/checkouts
165 taskclusterProxy: true
168 # Note: This task is built server side without the context or tooling that
169 # exist in tree so we must hard code the hash
170 image: 'taskcluster/decision:2.1.0@sha256:6db3b697d7a3c7aba440d72f04199331b872111cefff57206b8b8b1d53230360'
175 - /builds/worker/bin/run-task
176 - '--vcs-checkout=/builds/worker/checkouts/gecko'
177 - '--sparse-profile=build/sparse-profiles/taskgraph'
182 extraArgs: {$if: 'tasks_for == "cron"', then: '${cron.quoted_args}', else: ''}
184 $if: 'tasks_for == "action"'
186 cd /builds/worker/checkouts/gecko &&
187 ln -s /builds/worker/artifacts artifacts &&
188 ./mach --log-no-times taskgraph action-callback
190 cd /builds/worker/checkouts/gecko &&
191 ln -s /builds/worker/artifacts artifacts &&
192 ./mach --log-no-times taskgraph decision
193 --pushlog-id='${_pushId}'
194 --pushdate='${_pushDate}'
195 --project='${repository.project}'
196 --message="$GECKO_COMMIT_MSG"
197 --owner='${ownerEmail}'
198 --level='${repository.level}'
199 --base-repository="$GECKO_BASE_REPOSITORY"
200 --head-repository="$GECKO_HEAD_REPOSITORY"
201 --head-ref="$GECKO_HEAD_REF"
202 --head-rev="$GECKO_HEAD_REV"
208 path: '/builds/worker/artifacts'
209 expires: {$fromNow: '1 year'}
216 platform: gecko-decision
217 - $if: 'tasks_for == "hg-push"'
221 $if: 'tasks_for == "action"'
223 groupName: 'action-callback'
225 symbol: "${action.symbol}"
228 symbol: "${cron.job_symbol}"
229 - $if: 'tasks_for == "action"'
231 parent: '${action.taskGroupId}'
233 name: '${action.name}'
235 taskGroupId: '${action.taskGroupId}'
236 taskId: {$eval: 'taskId'}
237 input: {$eval: 'input'}
238 parameters: {$eval: 'parameters'}
239 - $if: 'tasks_for == "cron"'
241 cron: {$json: {$eval: 'cron'}}
242 - tasks_for: '${tasks_for}'
243 # Email format for try pushes
244 - $if: 'tasks_for == "hg-push" && repository.project == "try"'
248 subject: "Thank you for your try submission of ${push.revision}. It's the best!"
249 content: "Your try push has been submitted. Use the link to view the status of your jobs."
251 text: "Treeherder Jobs"
252 href: "https://treeherder.mozilla.org/#/jobs?repo=${repository.project}&revision=${push.revision}"