@@ -3,302 +3,8 @@ version: 1
33reporting : checks-v1
44policy :
55 pullRequests : collaborators
6- tasks :
7- - $let :
8- # XXX Set to `true` for private repos
9- privateRepo : false
10- # XXX Use
11- # `system` for system add-on,
12- # `privileged` for AMO or self-hosted privileged add-on,
13- # `mozillaonline-privileged` for Mozilla China add-on,
14- # `normandy-privileged` for normandy add-on
15- # to enable siging on push/PR.
16- xpiSigningType : " "
17- # The below doesn't need changing on initial repo setup
18- template :
19- repo : https://github.com/mozilla-extensions/xpi-template
20- branch : main
6+ hooks :
7+ - name : project-xpi/decision-v1
8+ context :
219 trustDomain : xpi
22- in :
23- $if : >
24- tasks_for in ["github-push", "action", "cron"]
25- || (tasks_for == "github-pull-request" && event.action in ["opened", "reopened", "synchronize"])
26- then :
27- $let :
28- # Github events have this stuff in different places...
29- ownerEmail :
30- $if : ' tasks_for == "github-push"'
31- then : ' ${event.pusher.email}'
32- # Assume Pull Request
33- else :
34- $if : ' tasks_for == "github-pull-request"'
35- then : ' ${event.pull_request.user.login}@users.noreply.github.com'
36- else :
37- $if : ' tasks_for in ["cron", "action"]'
38- then : ' ${tasks_for}@noreply.mozilla.org'
39- project :
40- $if : ' tasks_for == "github-push"'
41- then : ' ${event.repository.name}'
42- else :
43- $if : ' tasks_for == "github-pull-request"'
44- then : ' ${event.pull_request.head.repo.name}'
45- else :
46- $if : ' tasks_for in ["cron", "action"]'
47- then : ' ${repository.project}'
48- head_branch :
49- $if : ' tasks_for == "github-pull-request"'
50- then : ${event.pull_request.head.ref}
51- else :
52- $if : ' tasks_for == "github-push"'
53- then : ${event.ref}
54- else :
55- $if : ' tasks_for in ["cron", "action"]'
56- then : ' ${push.branch}'
57- head_sha :
58- $if : ' tasks_for == "github-push"'
59- then : ' ${event.after}'
60- else :
61- $if : ' tasks_for == "github-pull-request"'
62- then : ' ${event.pull_request.head.sha}'
63- else :
64- $if : ' tasks_for in ["cron", "action"]'
65- then : ' ${push.revision}'
66- ownTaskId :
67- $if : ' "github" in tasks_for'
68- then : {$eval: as_slugid("decision_task")}
69- else :
70- $if : ' tasks_for in ["cron", "action"]'
71- then : ' ${ownTaskId}'
72- repoFullName :
73- $if : ' tasks_for in "github-push"'
74- then : ' ${event.repository.full_name}'
75- else :
76- $if : ' tasks_for == "github-pull-request"'
77- then : ' ${event.pull_request.base.repo.full_name}'
78- else :
79- $if : ' tasks_for in ["cron", "action"]'
80- # Trim https://github.com/
81- then : ' ${repository.url[19:]}'
82- baseRepoUrl :
83- $if : ' !privateRepo' # public repo
84- then :
85- $if : ' tasks_for == "github-push"'
86- then : ' ${event.repository.html_url}'
87- else :
88- $if : ' tasks_for == "github-pull-request"'
89- then : ' ${event.pull_request.base.repo.html_url}'
90- else :
91- $if : ' tasks_for in ["cron", "action"]'
92- then : ' ${repository.url}'
93- else :
94- $if : ' tasks_for == "github-push"'
95- then : ' ${event.repository.ssh_url}'
96- else :
97- $if : ' tasks_for == "github-pull-request"'
98- then : ' ${event.pull_request.base.repo.ssh_url}'
99- else :
100- $if : ' tasks_for in ["cron", "action"]'
101- then : ' ${repository.url}'
102- repoUrl :
103- $if : ' !privateRepo' # public repo
104- then :
105- $if : ' tasks_for == "github-push"'
106- then : ' ${event.repository.html_url}'
107- else :
108- $if : ' tasks_for == "github-pull-request"'
109- then : ' ${event.pull_request.head.repo.html_url}'
110- else :
111- $if : ' tasks_for in ["cron", "action"]'
112- then : ' ${repository.url}'
113- else :
114- $if : ' tasks_for == "github-push"'
115- then : ' ${event.repository.ssh_url}'
116- else :
117- $if : ' tasks_for == "github-pull-request"'
118- then : ' ${event.pull_request.base.repo.ssh_url}'
119- else :
120- $if : ' tasks_for in ["cron", "action"]'
121- then : ' ${repository.url}'
122- in :
123- $let :
124- level : 1
125- in :
126- taskId :
127- $if : ' tasks_for != "action"'
128- then : ' ${ownTaskId}'
129- taskGroupId :
130- $if : ' tasks_for == "action"'
131- then :
132- ' ${action.taskGroupId}'
133- else :
134- ' ${ownTaskId}' # same as taskId; this is how automation identifies a decision task
135- schedulerId : ' ${trustDomain}-level-${level}'
136- created : {$fromNow: ''}
137- deadline : {$fromNow: '1 day'}
138- expires : {$fromNow: '1 year 1 second'} # 1 second so artifacts expire first, despite rounding errors
139- metadata :
140- $merge :
141- - owner : " ${ownerEmail}"
142- - $if : ' !privateRepo' # public repo
143- then :
144- source : ' ${repoUrl}/raw/${head_sha}/.taskcluster.yml'
145- else :
146- source : ' ssh://github.com/${repoUrl[15:-4]}/raw/${head_sha}/.taskcluster.yml'
147- - $if : ' tasks_for in ["github-push", "github-pull-request"]'
148- then :
149- name : " Decision Task"
150- description : ' The task that creates all of the other tasks in the task graph'
151- else :
152- $if : ' tasks_for == "action"'
153- then :
154- name : " Action: ${action.title}"
155- description : ' ${action.description}'
156- else :
157- name : " Decision Task for cron job ${cron.job_name}"
158- description : ' Created by a [cron task](https://tools.taskcluster.net/tasks/${cron.task_id})'
159- provisionerId : " xpi-${level}"
160- workerType : " decision"
161- tags :
162- $if : ' tasks_for in ["github-push", "github-pull-request"]'
163- then :
164- kind : decision-task
165- else :
166- $if : ' tasks_for == "action"'
167- then :
168- kind : ' action-callback'
169- else :
170- $if : ' tasks_for == "cron"'
171- then :
172- kind : cron-task
173- routes :
174- - checks
175- scopes :
176- $if : ' tasks_for == "github-push"'
177- then :
178- $let :
179- short_head_branch :
180- $if : ' head_branch[:10] == "refs/tags/"'
181- then : {$eval: 'head_branch[10:]'}
182- else :
183- $if : ' head_branch[:11] == "refs/heads/"'
184- then : {$eval: 'head_branch[11:]'}
185- else : ${head_branch}
186- in :
187- - ' assume:repo:github.com/${repoFullName}:branch:${short_head_branch}'
188-
189-
190- else :
191- $if : ' tasks_for == "github-pull-request"'
192- then :
193- - ' assume:repo:github.com/${repoFullName}:pull-request'
194-
195- else :
196- $if : ' tasks_for == "action"'
197- then :
198- # when all actions are hooks, we can calculate this directly rather than using a variable
199- - ' ${action.repo_scope}'
200- else :
201- - ' assume:repo:github.com/${repoFullName}:cron:${cron.job_name}'
202-
203-
204- requires : all-completed
205- priority : lowest
206- retries : 5
207-
208- payload :
209- env :
210- # run-task uses these to check out the source; the inputs
211- # to `mach taskgraph decision` are all on the command line.
212- $merge :
213- - XPI_BASE_REPOSITORY : ' ${baseRepoUrl}'
214- XPI_HEAD_REPOSITORY : ' ${repoUrl}'
215- XPI_HEAD_REF : ' ${head_branch}'
216- XPI_HEAD_REV : ' ${head_sha}'
217- XPI_REPOSITORY_TYPE : git
218- XPI_SIGNING_TYPE : ' ${xpiSigningType}'
219- TEMPLATE_BASE_REPOSITORY : ' ${template.repo}'
220- TEMPLATE_HEAD_REPOSITORY : ' ${template.repo}'
221- TEMPLATE_HEAD_REV : ' ${template.branch}'
222- TEMPLATE_HEAD_REF : ' ${template.branch}'
223- TEMPLATE_PIP_REQUIREMENTS : taskcluster/requirements.txt
224- TEMPLATE_REPOSITORY_TYPE : git
225- REPOSITORIES : {$json: {xpi: "XPI Manifest", template: "XPI Template"}}
226- - $if : ' privateRepo'
227- then :
228- XPI_SSH_SECRET_NAME : project/xpi/xpi-github-clone-ssh
229- - $if : ' tasks_for in ["github-pull-request"]'
230- then :
231- XPI_PULL_REQUEST_NUMBER : ' ${event.pull_request.number}'
232- - $if : ' tasks_for == "action"'
233- then :
234- ACTION_TASK_GROUP_ID : ' ${action.taskGroupId}' # taskGroupId of the target task
235- ACTION_TASK_ID : {$json: {$eval: 'taskId'}} # taskId of the target task (JSON-encoded)
236- ACTION_INPUT : {$json: {$eval: 'input'}}
237- ACTION_CALLBACK : ' ${action.cb_name}'
238- features :
239- taskclusterProxy : true
240- chainOfTrust : true
241- # Note: This task is built server side without the context or tooling that
242- # exist in tree so we must hard code the hash
243- image : mozillareleases/taskgraph:run-task-v9.2.1@sha256:2b9aeb5dbe8b99cec63eec2ef377e823b54ec3f564d9b732f1333883d950dc74
244-
245- maxRunTime : 1800
246-
247- command :
248- - /usr/local/bin/run-task
249- - ' --xpi-checkout=/builds/worker/checkouts/src'
250- - ' --template-checkout=/builds/worker/checkouts/template'
251- - ' --task-cwd=/builds/worker/checkouts/src'
252- - ' --'
253- - bash
254- - -cx
255- - $let :
256- extraArgs : {$if: 'tasks_for == "cron"', then: '${cron.quoted_args}', else: ''}
257- in :
258- $if : ' tasks_for == "action"'
259- then : >
260- cd /builds/worker/checkouts/src &&
261- rm -rf taskcluster &&
262- ln -s /builds/worker/checkouts/template/taskcluster taskcluster &&
263- ln -s /builds/worker/artifacts artifacts &&
264- ~/.local/bin/taskgraph action-callback
265- else : >
266- rm -rf taskcluster &&
267- ln -s /builds/worker/checkouts/template/taskcluster taskcluster &&
268- ln -s /builds/worker/artifacts artifacts &&
269- ~/.local/bin/taskgraph decision
270- --pushlog-id='0'
271- --pushdate='0'
272- --project='${project}'
273- --message=""
274- --owner='${ownerEmail}'
275- --level='${level}'
276- --base-repository="$XPI_BASE_REPOSITORY"
277- --head-repository="$XPI_HEAD_REPOSITORY"
278- --head-ref="$XPI_HEAD_REF"
279- --head-rev="$XPI_HEAD_REV"
280- --repository-type="$XPI_REPOSITORY_TYPE"
281- --tasks-for='${tasks_for}'
282- ${extraArgs}
283-
284- artifacts :
285- ' public ' :
286- type : ' directory'
287- path : ' /builds/worker/artifacts'
288- expires : {$fromNow: '1 year'}
289-
290- extra :
291- $merge :
292- - $if : ' tasks_for == "action"'
293- then :
294- parent : ' ${action.taskGroupId}'
295- action :
296- name : ' ${action.name}'
297- context :
298- taskGroupId : ' ${action.taskGroupId}'
299- taskId : {$eval: 'taskId'}
300- input : {$eval: 'input'}
301- - $if : ' tasks_for == "cron"'
302- then :
303- cron : {$json: {$eval: 'cron'}}
304- - tasks_for : ' ${tasks_for}'
10+ taskgraphVersion : 9.2.1
0 commit comments