5 # XXX We restrict taskcluster to collaborators so priviledged tests (like UI tests) can run on PRs
6 pullRequests: collaborators
11 revision: 0c5a68749f9a7672a7e56604b69a7bd41b036614
14 $if: 'tasks_for in ["github-pull-request", "github-push", "action", "cron"]'
17 # Github events have this stuff in different places...
19 $if: 'tasks_for == "github-push"'
20 then: '${event.pusher.email}'
23 $if: 'tasks_for == "github-pull-request"'
24 then: '${event.pull_request.user.login}@users.noreply.github.com'
26 $if: 'tasks_for in ["cron", "action"]'
27 then: '${tasks_for}@noreply.mozilla.org'
29 $if: 'tasks_for == "github-push"'
30 then: '${event.repository.html_url}'
32 $if: 'tasks_for == "github-pull-request"'
33 then: '${event.pull_request.base.repo.html_url}'
35 $if: 'tasks_for in ["cron", "action"]'
36 then: '${repository.url}'
38 $if: 'tasks_for == "github-push"'
39 then: '${event.repository.html_url}'
41 $if: 'tasks_for == "github-pull-request"'
42 then: '${event.pull_request.head.repo.html_url}'
44 $if: 'tasks_for in ["cron", "action"]'
45 then: '${repository.url}'
47 $if: 'tasks_for == "github-push"'
48 then: '${event.repository.name}'
50 $if: 'tasks_for == "github-pull-request"'
51 then: '${event.pull_request.head.repo.name}'
53 $if: 'tasks_for in ["cron", "action"]'
54 then: '${repository.project}'
56 $if: 'tasks_for == "github-pull-request"'
57 then: ${event.pull_request.head.ref}
59 $if: 'tasks_for == "github-push"'
62 $if: 'tasks_for in ["cron", "action"]'
63 then: '${push.branch}'
65 $if: 'tasks_for == "github-push"'
66 then: '${event.after}'
68 $if: 'tasks_for == "github-pull-request"'
69 then: '${event.pull_request.head.sha}'
71 $if: 'tasks_for in ["cron", "action"]'
72 then: '${push.revision}'
74 $if: '"github" in tasks_for'
75 then: {$eval: as_slugid("decision_task")}
77 $if: 'tasks_for == "cron"'
82 $if: 'tasks_for in ["github-push", "github-release", "action", "cron"] && repoUrl == "https://github.com/mozilla-mobile/fenix"'
85 $if: 'tasks_for in ["cron", "action"]'
86 then: '${repository.level}'
89 taskId: '${ownTaskId}'
91 $if: 'tasks_for == "action"'
93 '${action.taskGroupId}'
95 '${ownTaskId}' # same as taskId; this is how automation identifies a decision task
96 schedulerId: '${trustDomain}-level-${level}'
97 created: {$fromNow: ''}
98 deadline: {$fromNow: '1 day'}
99 expires: {$fromNow: '1 year 1 second'} # 1 second so artifacts expire first, despite rounding errors
102 - owner: "${ownerEmail}"
103 source: '${repoUrl}/raw/${head_sha}/.taskcluster.yml'
104 - $if: 'tasks_for in ["github-push", "github-pull-request"]'
106 name: "Decision Task"
107 description: 'The task that creates all of the other tasks in the task graph'
109 $if: 'tasks_for == "action"'
111 name: "Action: ${action.title}"
112 description: '${action.description}'
114 name: "Decision Task for cron job ${cron.job_name}"
115 description: 'Created by a [cron task](https://tools.taskcluster.net/tasks/${cron.task_id})'
116 provisionerId: "aws-provisioner-v1"
117 workerType: "mobile-${level}-decision"
119 $if: 'tasks_for in ["github-push", "github-pull-request"]'
123 $if: 'tasks_for == "action"'
125 kind: 'action-callback'
127 $if: 'tasks_for == "cron"'
133 - $if: 'tasks_for != "github-pull-request"'
135 - "tc-treeherder.v2.${project}.${head_sha}"
138 # `https://` is 8 characters so, ${repoUrl[8:]} is the repository without the protocol.
139 $if: 'tasks_for == "github-push"'
143 $if: 'head_branch[:10] == "refs/tags/"'
144 then: {$eval: 'head_branch[10:]'}
146 $if: 'head_branch[:11] == "refs/heads/"'
147 then: {$eval: 'head_branch[11:]'}
150 - 'assume:repo:${repoUrl[8:]}:branch:${short_head_branch}'
152 $if: 'tasks_for == "github-pull-request"'
154 - 'assume:repo:github.com/${event.pull_request.base.repo.full_name}:pull-request'
156 $if: 'tasks_for == "action"'
158 # when all actions are hooks, we can calculate this directly rather than using a variable
159 - '${action.repo_scope}'
161 - 'assume:repo:${repoUrl[8:]}:cron:${cron.job_name}'
163 requires: all-completed
169 # run-task uses these to check out the source; the inputs
170 # to `mach taskgraph decision` are all on the command line.
172 - MOBILE_BASE_REPOSITORY: '${baseRepoUrl}'
173 MOBILE_HEAD_REPOSITORY: '${repoUrl}'
174 MOBILE_HEAD_REF: '${head_branch}'
175 MOBILE_HEAD_REV: '${head_sha}'
176 MOBILE_REPOSITORY_TYPE: git
177 TASKGRAPH_BASE_REPOSITORY: https://hg.mozilla.org/ci/taskgraph
178 TASKGRAPH_HEAD_REPOSITORY: https://hg.mozilla.org/ci/${taskgraph.branch}
179 TASKGRAPH_HEAD_REV: ${taskgraph.revision}
180 TASKGRAPH_REPOSITORY_TYPE: hg
181 REPOSITORIES: {$json: {mobile: "Fenix", taskgraph: "Taskgraph"}}
182 HG_STORE_PATH: /builds/worker/checkouts/hg-store
183 ANDROID_SDK_ROOT: /builds/worker/android-sdk
184 - $if: 'tasks_for in ["github-pull-request"]'
186 MOBILE_PULL_REQUEST_NUMBER: '${event.pull_request.number}'
187 - $if: 'tasks_for == "action"'
189 ACTION_TASK_GROUP_ID: '${action.taskGroupId}' # taskGroupId of the target task
190 ACTION_TASK_ID: {$json: {$eval: 'taskId'}} # taskId of the target task (JSON-encoded)
191 ACTION_INPUT: {$json: {$eval: 'input'}}
192 ACTION_CALLBACK: '${action.cb_name}'
194 taskclusterProxy: true
196 # Note: This task is built server side without the context or tooling that
197 # exist in tree so we must hard code the hash
199 mozillareleases/taskgraph:decision-mobile-6020473b1a928d8df50e234a7ca2e81ade2220a4fb5fbe16b02477dd64a49728@sha256:98d226736b7d03907114bf37938002b90e8a37cbe3a297690e349f1ddddb1d7c
204 - /usr/local/bin/run-task
205 - '--mobile-checkout=/builds/worker/checkouts/src'
206 - '--taskgraph-checkout=/builds/worker/checkouts/taskgraph'
207 - '--task-cwd=/builds/worker/checkouts/src'
212 extraArgs: {$if: 'tasks_for == "cron"', then: '${cron.quoted_args}', else: ''}
214 $if: 'tasks_for == "action"'
216 cd /builds/worker/checkouts/src &&
217 ln -s /builds/worker/artifacts artifacts &&
218 taskgraph action-callback
220 PIP_IGNORE_INSTALLED=0 pip install --user /builds/worker/checkouts/taskgraph &&
221 taskcluster/scripts/install-sdk.sh &&
222 ln -s /builds/worker/artifacts artifacts &&
223 ~/.local/bin/taskgraph decision
226 --project='${project}'
228 --owner='${ownerEmail}'
230 --base-repository="$MOBILE_BASE_REPOSITORY"
231 --head-repository="$MOBILE_HEAD_REPOSITORY"
232 --head-ref="$MOBILE_HEAD_REF"
233 --head-rev="$MOBILE_HEAD_REV"
234 --repository-type="$MOBILE_REPOSITORY_TYPE"
235 --tasks-for='${tasks_for}'
241 path: '/builds/worker/artifacts'
242 expires: {$fromNow: '1 year'}
249 platform: gecko-decision
250 - $if: 'tasks_for in ["github-push", "github-pull-request"]'
254 $if: 'tasks_for == "action"'
256 groupName: 'action-callback'
258 symbol: "${action.symbol}"
261 symbol: "${cron.job_symbol}"
262 - $if: 'tasks_for == "action"'
264 parent: '${action.taskGroupId}'
266 name: '${action.name}'
268 taskGroupId: '${action.taskGroupId}'
269 taskId: {$eval: 'taskId'}
270 input: {$eval: 'input'}
271 - $if: 'tasks_for == "cron"'
273 cron: {$json: {$eval: 'cron'}}
274 - tasks_for: '${tasks_for}'