Revision control

Other Tools

1
# This Source Code Form is subject to the terms of the Mozilla Public
2
# License, v. 2.0. If a copy of the MPL was not distributed with this
3
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
---
5
# yamllint disable rule:indentation
6
# This file is rendered via JSON-e by
7
# - mozilla-taskcluster - See
9
# {
10
# tasks_for: 'hg-push',
11
# push: {owner, comment, pushlog_id, pushdate},
12
# repository: {url, project, level},
13
# now,
14
# as_slugid: // function
15
# ownTaskId: // taskId of the task that will be created
16
# }
17
#
18
# - cron tasks - See taskcluster/taskgraph/cron/decision.py
19
# {
20
# tasks_for: 'cron',
21
# push: {revision, pushlog_id, pushdate, owner}
22
# repository: {url, project, level},
23
# cron: {task_id, job_name, job_symbol, quoted_args},
24
# now,
25
# ownTaskId: // taskId of the task that will be created
26
# }
27
#
28
# - action tasks - See:
29
# * taskcluster/taskgraph/actions/registry.py,
31
# * ci-admin:ciadmin/generate/in_tree_actions.py
32
#
33
# The registry generates the hookPayload that appears in actions.json, and
34
# contains data from the decision task as well as JSON-e code to combine that
35
# with data supplied as part of the action spec. When the hook is fired, the
36
# hookPayload is rendered with JSON-e to produce a payload for the hook task
37
# template.
38
#
39
# The ci-admin code wraps the content of this file (.taskcluster.yml) with a
40
# JSON-e $let statement that produces the context described below, and
41
# installs that as the hook task template.
42
#
43
# {
44
# tasks_for: 'action',
45
# push: {owner, pushlog_id, revision},
46
# repository: {url, project, level},
47
# input,
48
# parameters,
49
# taskId, // targetted taskId
50
# taskGroupId, // targetted taskGroupId
51
# action: {name, title, description, taskGroupId, symbol, repo_scope, cb_name}
52
# ownTaskId: // taskId of the task that will be created
53
# }
54
55
version: 1
56
57
tasks:
58
- $let:
59
# sometimes the push user is just `ffxbld` or the like, but we want an email-like field..
60
ownerEmail: {$if: '"@" in push.owner', then: '${push.owner}', else: '${push.owner}@noreply.mozilla.org'}
61
# ensure there's no trailing `/` on the repo URL
62
repoUrl: {$if: 'repository.url[-1] == "/"', then: {$eval: 'repository.url[:-1]'}, else: {$eval: 'repository.url'}}
63
# Hardcode cron push info for now, so that we can transition to using real values without breaking callers of Chain of Trust
64
_pushId: {$if: 'tasks_for == "cron"', then: '-1', else: {$eval: 'push.pushlog_id'}}
65
in:
66
taskId: {$if: 'tasks_for != "action"', then: '${ownTaskId}'}
67
taskGroupId:
68
$if: 'tasks_for == "action"'
69
then:
70
'${action.taskGroupId}'
71
else:
72
'${ownTaskId}' # same as taskId; this is how automation identifies a decision tsak
73
schedulerId: 'comm-level-${repository.level}'
74
75
created: {$fromNow: ''}
76
deadline: {$fromNow: '1 day'}
77
expires: {$fromNow: '1 year 1 second'} # 1 second so artifacts expire first, despite rounding errors
78
79
metadata:
80
$merge:
81
- owner: "${ownerEmail}"
82
source: "${repoUrl}/raw-file/${push.revision}/.taskcluster.yml"
83
- $if: 'tasks_for == "hg-push"'
84
then:
85
name: "Thunderbird Decision Task"
86
description: 'The task that creates all of the other tasks in the task graph'
87
else:
88
$if: 'tasks_for == "action"'
89
then:
90
name: "Action: ${action.title}"
91
description: '${action.description}'
92
else:
93
name: "Decision Task for cron job ${cron.job_name}"
94
description: 'Created by a [cron task](https://tools.taskcluster.net/tasks/${cron.task_id})'
95
96
provisionerId: "aws-provisioner-v1"
97
workerType: "gecko-${repository.level}-decision"
98
99
tags:
100
$if: 'tasks_for == "hg-push"'
101
then: {createdForUser: "${ownerEmail}"}
102
else:
103
$if: 'tasks_for == "action"'
104
then:
105
createdForUser: '${ownerEmail}'
106
kind: 'action-callback'
107
108
routes:
109
$flatten:
110
- "tc-treeherder.v2.${repository.project}.${push.revision}.${push.pushlog_id}"
111
- "tc-treeherder-stage.v2.${repository.project}.${push.revision}.${push.pushlog_id}"
112
- $if: 'tasks_for == "hg-push"'
113
then:
114
- "index.comm.v2.${repository.project}.latest.taskgraph.decision"
115
- "index.comm.v2.${repository.project}.revision.${push.revision}.taskgraph.decision"
116
- "index.comm.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision"
117
- "notify.email.${ownerEmail}.on-failed"
118
- "notify.email.${ownerEmail}.on-exception"
119
else:
120
$if: 'tasks_for == "action"'
121
then:
122
- "notify.email.taskcluster-notifications+action-task@mozilla.com.on-failed"
123
- "notify.email.taskcluster-notifications+action-task@mozilla.com.on-exception"
124
- "index.comm.v2.${repository.project}.pushlog-id.${_pushId}.actions.${ownTaskId}"
125
else:
126
- "index.comm.v2.${repository.project}.latest.taskgraph.decision-${cron.job_name}"
127
128
scopes:
129
$if: 'tasks_for == "hg-push"'
130
then:
131
- 'assume:repo:${repoUrl[8:]}:branch:default'
132
- 'queue:route:notify.email.${ownerEmail}.*'
133
- 'in-tree:hook-action:project-comm/in-tree-action-${repository.level}-*'
134
else:
135
$if: 'tasks_for == "action"'
136
then:
137
- '${action.repo_scope}'
138
else:
139
- 'assume:repo:${repoUrl[8:]}:cron:${cron.job_name}'
140
141
dependencies: []
142
requires: all-completed
143
144
priority: lowest
145
retries: 5
146
147
payload:
148
env:
149
# checkout-gecko uses these to check out the source; the inputs
150
# to `mach taskgraph decision` are all on the command line.
151
$merge:
152
- COMM_BASE_REPOSITORY: 'https://hg.mozilla.org/comm-central'
153
COMM_HEAD_REPOSITORY: '${repoUrl}'
154
COMM_HEAD_REF: '${push.revision}'
155
COMM_HEAD_REV: '${push.revision}'
156
HG_STORE_PATH: /builds/worker/checkouts/hg-store
157
TASKCLUSTER_CACHES: /builds/worker/checkouts
158
# someday, these will be provided by the worker - Bug 1492664
159
TASKCLUSTER_ROOT_URL: https://taskcluster.net
160
TASKCLUSTER_PROXY_URL: http://taskcluster
161
- $if: 'tasks_for == "action"'
162
then:
163
ACTION_TASK_GROUP_ID: '${action.taskGroupId}' # taskGroupId of the target task
164
ACTION_TASK_ID: {$json: {$eval: 'taskId'}} # taskId of the target task (JSON-encoded)
165
ACTION_INPUT: {$json: {$eval: 'input'}}
166
ACTION_CALLBACK: '${action.cb_name}'
167
ACTION_PARAMETERS: {$json: {$eval: 'parameters'}}
168
169
cache:
170
level-${repository.level}-checkouts-sparse-v2: /builds/worker/checkouts
171
172
features:
173
taskclusterProxy: true
174
chainOfTrust: true
175
176
# Note: This task is built server side without the context or tooling that
177
# exist in tree so we must hard code the hash
178
image: 'taskcluster/decision:2.2.0@sha256:cbeadf57300de60408bf1337e723f0cb1f0200f559799cb54deb9535d1e03b4a'
179
180
maxRunTime: 1800
181
182
command:
183
- /builds/worker/bin/comm-task-env
184
- /builds/worker/bin/run-task
185
- '--gecko-checkout=/builds/worker/checkouts/gecko'
186
- '--gecko-sparse-profile=build/sparse-profiles/taskgraph'
187
- '--comm-checkout=/builds/worker/checkouts/gecko/comm'
188
- '--'
189
- bash
190
- -cx
191
- $let:
192
extraArgs: {$if: 'tasks_for == "cron"', then: '${cron.quoted_args}', else: ''}
193
in:
194
$if: 'tasks_for == "action"'
195
then: >
196
cd /builds/worker/checkouts/gecko &&
197
ln -s /builds/worker/artifacts artifacts &&
198
./mach --log-no-times taskgraph action-callback
199
--root=comm/taskcluster/ci
200
else: >
201
cd /builds/worker/checkouts/gecko &&
202
ln -s /builds/worker/artifacts artifacts &&
203
./mach --log-no-times taskgraph decision
204
--root=comm/taskcluster/ci
205
--pushlog-id='${push.pushlog_id}'
206
--pushdate='${push.pushdate}'
207
--project='${repository.project}'
208
--owner='${ownerEmail}'
209
--level='${repository.level}'
210
--tasks-for='${tasks_for}'
211
--base-repository="$GECKO_BASE_REPOSITORY"
212
--head-repository="$GECKO_HEAD_REPOSITORY"
213
--head-ref="$GECKO_HEAD_REF"
214
--head-rev="$GECKO_HEAD_REV"
215
--comm-base-repository="$COMM_BASE_REPOSITORY"
216
--comm-head-repository="$COMM_HEAD_REPOSITORY"
217
--comm-head-ref="$COMM_HEAD_REF"
218
--comm-head-rev="$COMM_HEAD_REV"
219
--try-task-config-file=comm/try_task_config.json
220
${extraArgs}
221
222
artifacts:
223
'public':
224
type: 'directory'
225
path: '/builds/worker/artifacts'
226
expires: {$fromNow: '1 year'}
227
228
extra:
229
$merge:
230
- treeherder:
231
$merge:
232
- machine:
233
platform: gecko-decision
234
- $if: 'tasks_for == "hg-push"'
235
then:
236
symbol: D
237
else:
238
$if: 'tasks_for == "action"'
239
then:
240
groupName: 'action-callback'
241
groupSymbol: AC
242
symbol: "${action.symbol}"
243
else:
244
groupSymbol: cron
245
symbol: "${cron.job_symbol}"
246
- $if: 'tasks_for == "action"'
247
then:
248
parent: '${action.taskGroupId}'
249
action:
250
name: '${action.name}'
251
context:
252
taskGroupId: '${action.taskGroupId}'
253
taskId: {$eval: 'taskId'}
254
input: {$eval: 'input'}
255
parameters: {$eval: 'parameters'}
256
- $if: 'tasks_for == "cron"'
257
then:
258
cron: {$json: {$eval: 'cron'}}
259
- tasks_for: '${tasks_for}'