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}
133 tasks_for in ["github-push", "action", "cron"] && repoUrl == canonicalRepo
138 $if: 'base_ref[:11] == "refs/heads/"'
139 then: {$eval: 'base_ref[11:]'}
143 $if: 'head_ref[:11] == "refs/heads/"'
144 then: {$eval: 'head_ref[11:]'}
148 tasks_for in ["action", "cron"]
149 || (isPullRequest && pullRequestAction in ["opened", "reopened", "synchronize"])
150 || (tasks_for == "github-push" && head_ref[:10] != "refs/tags/" && short_head_ref != "staging.tmp" && short_head_ref != "trying.tmp" && short_head_ref[:8] != "mergify/")
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: '${repoUrl}/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 # run-task uses these to check out the source; the inputs
239 # to `mach taskgraph decision` are all on the command line.
241 - MOBILE_BASE_REPOSITORY: '${baseRepoUrl}'
242 MOBILE_BASE_REF: '${short_base_ref}'
243 MOBILE_BASE_REV: '${base_sha}'
244 MOBILE_HEAD_REPOSITORY: '${repoUrl}'
245 MOBILE_HEAD_REF: '${short_head_ref}'
246 MOBILE_HEAD_REV: '${head_sha}'
247 MOBILE_PIP_REQUIREMENTS: taskcluster/requirements.txt
248 MOBILE_REPOSITORY_TYPE: git
250 REPOSITORIES: {$json: {mobile: "firefox-android"}}
251 - $if: 'isPullRequest'
253 MOBILE_PULL_REQUEST_NUMBER: '${event.pull_request.number}'
254 - $if: 'tasks_for == "action"'
256 ACTION_TASK_GROUP_ID: '${action.taskGroupId}' # taskGroupId of the target task
257 ACTION_TASK_ID: {$json: {$eval: 'taskId'}} # taskId of the target task (JSON-encoded)
258 ACTION_INPUT: {$json: {$eval: 'input'}}
259 ACTION_CALLBACK: '${action.cb_name}'
261 taskclusterProxy: true
263 # Note: This task is built server side without the context or tooling that
264 # exist in tree so we must hard code the hash
266 mozillareleases/taskgraph:decision-10068f116a3800a829ddba367136a95bef5634e06f77e051859586202c93b18a@sha256:a74ed430fd80ebb647bb4a5b019523cf5f69246ed2c2603386dbc8f7200c8140
271 - /usr/local/bin/run-task
272 - '--mobile-checkout=/builds/worker/checkouts/vcs'
273 - '--task-cwd=/builds/worker/checkouts/vcs'
278 extraArgs: {$if: 'tasks_for == "cron"', then: '${cron.quoted_args}', else: ''}
280 $if: 'tasks_for == "action"'
282 cd /builds/worker/checkouts/vcs &&
283 ln -s /builds/worker/artifacts artifacts &&
284 ~/.local/bin/taskgraph action-callback
286 cd /builds/worker/checkouts/vcs &&
287 ln -s /builds/worker/artifacts artifacts &&
288 ~/.local/bin/taskgraph decision
291 --project='${project}'
293 --owner='${ownerEmail}'
295 --base-repository="$MOBILE_BASE_REPOSITORY"
296 --base-ref="$MOBILE_BASE_REF"
297 --base-rev="$MOBILE_BASE_REV"
298 --head-repository="$MOBILE_HEAD_REPOSITORY"
299 --head-ref="$MOBILE_HEAD_REF"
300 --head-rev="$MOBILE_HEAD_REV"
301 --repository-type="$MOBILE_REPOSITORY_TYPE"
302 --tasks-for='${tasks_for}'
308 path: '/builds/worker/artifacts'
309 expires: {$fromNow: '1 year'}
310 'public/docker-contexts':
312 path: '/builds/worker/checkouts/vcs/docker-contexts'
313 # This needs to be at least the deadline of the
314 # decision task + the docker-image task deadlines.
315 # It is set to a week to allow for some time for
316 # debugging, but they are not useful long-term.
317 expires: {$fromNow: '7 day'}
324 platform: gecko-decision
325 - $if: 'isPullRequest || tasks_for == "github-push"'
329 $if: 'tasks_for == "action"'
331 groupName: 'action-callback'
333 symbol: "${action.symbol}"
336 symbol: "${cron.job_symbol}"
337 - $if: 'tasks_for == "action"'
339 parent: '${action.taskGroupId}'
341 name: '${action.name}'
343 taskGroupId: '${action.taskGroupId}'
344 taskId: {$eval: 'taskId'}
345 input: {$eval: 'input'}
346 clientId: {$eval: 'clientId'}
347 - $if: 'tasks_for == "cron"'
349 cron: {$json: {$eval: 'cron'}}
350 - tasks_for: '${tasks_for}'