5 pullRequests: public_restricted
9 canonicalRepo: https://github.com/mozilla-mobile/firefox-android
11 # We now support both github-pull-request and github-pull-request-untrusted
12 $eval: 'tasks_for[:19] == "github-pull-request"'
15 $if: '"github" in tasks_for'
16 then: {$eval: as_slugid("decision_task")}
18 $if: 'tasks_for == "cron"'
22 # Github events have this stuff in different places...
24 $if: 'tasks_for in ["cron", "action"]'
25 then: '${tasks_for}@noreply.mozilla.org'
27 # GitHub adds "[bot]" to bot usernames and that doesn't validate as email.
28 $if: 'event.sender.login == "bors[bot]"'
29 then: 'skaspari+mozlando@mozilla.com' # It must match what's in bors.toml
31 $if: 'tasks_for == "github-push"'
33 $if: 'event.pusher.email'
34 then: '${event.pusher.email}'
35 else: '${event.pusher.name}@users.noreply.github.com'
38 then: '${event.pull_request.user.login}@users.noreply.github.com'
41 $if: 'tasks_for in "github-push"'
42 then: '${event.repository.full_name}'
45 then: '${event.pull_request.base.repo.full_name}'
47 $if: 'tasks_for in ["cron", "action"]'
48 # Trim https://github.com/
49 then: '${repository.url[19:]}'
52 $if: 'tasks_for == "github-push"'
53 then: '${event.repository.html_url}'
56 then: '${event.pull_request.base.repo.html_url}'
58 $if: 'tasks_for in ["cron", "action"]'
59 then: '${repository.url}'
61 $if: 'tasks_for == "github-push"'
62 then: '${event.repository.html_url}'
65 then: '${event.pull_request.head.repo.html_url}'
67 $if: 'tasks_for in ["cron", "action"]'
68 then: '${repository.url}'
70 $if: 'tasks_for == "github-push"'
71 then: '${event.repository.name}'
74 then: '${event.pull_request.head.repo.name}'
76 $if: 'tasks_for in ["cron", "action"]'
77 then: '${repository.project}'
80 then: ${event.pull_request.base.ref}
82 # event.base_ref is barely documented[1]. Testing showed it's only
83 # defined when creating a new branch. It's null when pushing to an
86 # [1] https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push
87 $if: 'tasks_for == "github-push" && event.base_ref'
88 then: ${event.base_ref}
90 $if: 'tasks_for == "github-push"'
93 $if: 'tasks_for in ["cron", "action"]'
95 $if: 'push.branch[:11] == "refs/heads/"'
96 then: {$eval: 'push.branch[11:]'}
100 then: ${event.pull_request.head.ref}
102 $if: 'tasks_for == "github-push"'
105 $if: 'tasks_for in ["cron", "action"]'
106 then: '${push.branch}'
108 $if: 'tasks_for == "github-push"'
109 then: '${event.before}'
112 then: '${event.pull_request.base.sha}'
114 $if: 'tasks_for in ["cron", "action"]'
115 then: '${push.revision}'
117 $if: 'tasks_for == "github-push"'
118 then: '${event.after}'
121 then: '${event.pull_request.head.sha}'
123 $if: 'tasks_for in ["cron", "action"]'
124 then: '${push.revision}'
127 then: ${event.action}
131 tasks_for in ["action", "cron"]
132 || (isPullRequest && pullRequestAction in ["opened", "reopened", "synchronize"])
133 || (tasks_for == "github-push" && head_ref[:10] != "refs/tags/" && head_ref != "staging.tmp" && head_ref != "trying.tmp") && (head_ref[:8] != "mergify/")
138 tasks_for in ["github-push", "action", "cron"] && repoUrl == canonicalRepo
143 $if: 'base_ref[:11] == "refs/heads/"'
144 then: {$eval: 'base_ref[11:]'}
148 $if: 'head_ref[:11] == "refs/heads/"'
149 then: {$eval: 'head_ref[11:]'}
153 - $if: 'tasks_for != "action"'
155 taskId: '${ownTaskId}'
157 $if: 'tasks_for == "action"'
159 '${action.taskGroupId}'
161 '${ownTaskId}' # same as taskId; this is how automation identifies a decision task
162 schedulerId: '${trustDomain}-level-${level}'
163 created: {$fromNow: ''}
164 deadline: {$fromNow: '1 day'}
165 expires: {$fromNow: '1 year 1 second'} # 1 second so artifacts expire first, despite rounding errors
168 - owner: "${ownerEmail}"
169 source: 'https://github.com/${repoFullName}/raw/${head_sha}/.taskcluster.yml'
170 - $if: 'isPullRequest || tasks_for == "github-push"'
172 name: "Decision Task"
173 description: 'The task that creates all of the other tasks in the task graph'
175 $if: 'tasks_for == "action"'
177 name: "Action: ${action.title}"
179 ${action.description}
181 Action triggered by clientID `${clientId}`
183 name: "Decision Task for cron job ${cron.job_name}"
184 description: 'Created by a [cron task](https://firefox-ci-tc.services.mozilla.com/tasks/${cron.task_id})'
185 provisionerId: "mobile-${level}"
186 workerType: "decision-gcp"
188 $if: 'isPullRequest || tasks_for == "github-push"'
192 $if: 'tasks_for == "action"'
194 kind: 'action-callback'
196 $if: 'tasks_for == "cron"'
202 - $if: 'level == "3" || repoUrl == "https://github.com/mozilla-releng/staging-firefox-android"'
204 - tc-treeherder.v2.${project}.${head_sha}
205 - $if: 'tasks_for == "github-push"'
207 - index.mobile.v2.${project}.branch.${short_head_ref}.latest.taskgraph.decision
208 - index.mobile.v2.${project}.branch.${short_head_ref}.revision.${head_sha}.taskgraph.decision
209 - index.mobile.v2.${project}.revision.${head_sha}.taskgraph.decision
210 - $if: 'tasks_for == "cron"'
212 # cron context provides ${head_ref} as a short one
213 - index.mobile.v2.${project}.branch.${head_ref}.latest.taskgraph.decision-${cron.job_name}
214 - index.mobile.v2.${project}.branch.${head_ref}.revision.${head_sha}.taskgraph.decision-${cron.job_name}
215 - index.mobile.v2.${project}.branch.${head_ref}.revision.${head_sha}.taskgraph.cron.${ownTaskId}
217 $if: 'tasks_for == "github-push"'
219 - 'assume:repo:github.com/${repoFullName}:branch:${short_head_ref}'
223 - 'assume:repo:github.com/${repoFullName}:${tasks_for[7:]}'
225 $if: 'tasks_for == "action"'
227 # when all actions are hooks, we can calculate this directly rather than using a variable
228 - '${action.repo_scope}'
230 - 'assume:repo:github.com/${repoFullName}:cron:${cron.job_name}'
232 requires: all-completed
238 "${trustDomain}-level-${level}-gradle-decision-cache": /builds/worker/.gradle
240 # run-task uses these to check out the source; the inputs
241 # to `mach taskgraph decision` are all on the command line.
243 - MOBILE_BASE_REPOSITORY: '${baseRepoUrl}'
244 MOBILE_BASE_REF: '${short_base_ref}'
245 MOBILE_BASE_REV: '${base_sha}'
246 MOBILE_HEAD_REPOSITORY: '${repoUrl}'
247 MOBILE_HEAD_REF: '${short_head_ref}'
248 MOBILE_HEAD_REV: '${head_sha}'
249 MOBILE_PIP_REQUIREMENTS: taskcluster/requirements.txt
250 MOBILE_REPOSITORY_TYPE: git
252 REPOSITORIES: {$json: {mobile: "firefox-android"}}
253 TASKCLUSTER_CACHES: /builds/worker/.gradle
254 - $if: 'isPullRequest'
256 MOBILE_PULL_REQUEST_NUMBER: '${event.pull_request.number}'
257 - $if: 'tasks_for == "action"'
259 ACTION_TASK_GROUP_ID: '${action.taskGroupId}' # taskGroupId of the target task
260 ACTION_TASK_ID: {$json: {$eval: 'taskId'}} # taskId of the target task (JSON-encoded)
261 ACTION_INPUT: {$json: {$eval: 'input'}}
262 ACTION_CALLBACK: '${action.cb_name}'
264 taskclusterProxy: true
266 # Note: This task is built server side without the context or tooling that
267 # exist in tree so we must hard code the hash
269 mozillareleases/taskgraph:decision-mobile-c0fca789e58f5458999ac9780a45897340f96f2a273c3c5ea1d2be438ab5223b@sha256:e9f387c9049db80281eaed73c7173b653be195423cdd58300f71d9796d8f1ac7
274 - /usr/local/bin/run-task
275 - '--mobile-checkout=/builds/worker/checkouts/vcs'
276 - '--task-cwd=/builds/worker/checkouts/vcs'
281 extraArgs: {$if: 'tasks_for == "cron"', then: '${cron.quoted_args}', else: ''}
283 $if: 'tasks_for == "action"'
285 cd /builds/worker/checkouts/vcs &&
286 ln -s /builds/worker/artifacts artifacts &&
287 ~/.local/bin/taskgraph action-callback
289 cd /builds/worker/checkouts/vcs &&
290 ln -s /builds/worker/artifacts artifacts &&
291 ~/.local/bin/taskgraph decision
294 --project='${project}'
296 --owner='${ownerEmail}'
298 --base-repository="$MOBILE_BASE_REPOSITORY"
299 --base-ref="$MOBILE_BASE_REF"
300 --base-rev="$MOBILE_BASE_REV"
301 --head-repository="$MOBILE_HEAD_REPOSITORY"
302 --head-ref="$MOBILE_HEAD_REF"
303 --head-rev="$MOBILE_HEAD_REV"
304 --repository-type="$MOBILE_REPOSITORY_TYPE"
305 --tasks-for='${tasks_for}'
311 path: '/builds/worker/artifacts'
312 expires: {$fromNow: '1 year'}
313 'public/docker-contexts':
315 path: '/builds/worker/checkouts/vcs/docker-contexts'
316 # This needs to be at least the deadline of the
317 # decision task + the docker-image task deadlines.
318 # It is set to a week to allow for some time for
319 # debugging, but they are not useful long-term.
320 expires: {$fromNow: '7 day'}
327 platform: gecko-decision
328 - $if: 'isPullRequest || tasks_for == "github-push"'
332 $if: 'tasks_for == "action"'
334 groupName: 'action-callback'
336 symbol: "${action.symbol}"
339 symbol: "${cron.job_symbol}"
340 - $if: 'tasks_for == "action"'
342 parent: '${action.taskGroupId}'
344 name: '${action.name}'
346 taskGroupId: '${action.taskGroupId}'
347 taskId: {$eval: 'taskId'}
348 input: {$eval: 'input'}
349 clientId: {$eval: 'clientId'}
350 - $if: 'tasks_for == "cron"'
352 cron: {$json: {$eval: 'cron'}}
353 - tasks_for: '${tasks_for}'