forked from taskcluster/taskcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.taskcluster.yml
176 lines (163 loc) · 8.8 KB
/
.taskcluster.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
---
version: 1
reporting: checks-v1
policy:
pullRequests: public
tasks:
- $let:
taskgraph:
branch: taskgraph
revision: cab4565345d0d0effa66f18fe91335dd6d744031
trustDomain: taskcluster
in:
$let:
# We set some of these directly in tc because we don't have some mozilla-specific concepts
ownerEmail: [email protected]
level: 1
# Github events have this stuff in different places...
baseRepoUrl:
$if: 'tasks_for in ["github-push", "github-release"]'
then: '${event.repository.html_url}'
else:
$if: 'tasks_for == "github-pull-request"'
then: '${event.pull_request.base.repo.html_url}'
repoUrl:
$if: 'tasks_for in ["github-push", "github-release"]'
then: '${event.repository.html_url}'
else:
$if: 'tasks_for == "github-pull-request"'
then: '${event.pull_request.head.repo.html_url}'
project:
$if: 'tasks_for in ["github-push", "github-release"]'
then: '${event.repository.name}'
else:
$if: 'tasks_for == "github-pull-request"'
then: '${event.pull_request.head.repo.name}'
head_branch:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.head.ref}
else:
$if: 'tasks_for == "github-push"'
then: ${event.ref}
else:
$if: 'tasks_for == "github-release"'
then: '${event.release.target_commitish}'
head_sha:
$if: 'tasks_for == "github-push"'
then: '${event.after}'
else:
$if: 'tasks_for == "github-pull-request"'
then: '${event.pull_request.head.sha}'
else:
$if: 'tasks_for == "github-release"'
then: '${event.release.tag_name}'
head_tag:
$if: 'tasks_for == "github-release"'
then: '${event.release.tag_name}'
else: ''
ownTaskId: {$eval: as_slugid("decision_task")}
pullRequestAction:
$if: 'tasks_for == "github-pull-request"'
then: ${event.action}
else: 'UNDEFINED'
in:
$if: >
(tasks_for == "github-pull-request" && pullRequestAction in ["opened", "reopened", "synchronize"])
|| (tasks_for == "github-push" && project == "taskcluster" && (event["ref"] == "refs/heads/master" || event["ref"] == "refs/heads/main"))
|| (tasks_for == "github-push" && project == "taskcluster" && event["ref"][:11] == "refs/tags/v")
|| (tasks_for == "github-push" && project == "staging-releases" && event["ref"][:27] == "refs/heads/staging-release/")
then:
schedulerId: taskcluster-level-${level}
taskId: '${ownTaskId}'
taskGroupId: '${ownTaskId}' # same as taskId; this is how automation identifies a decision task
created: {$fromNow: ''}
deadline: {$fromNow: '1 day'}
expires: {$fromNow: '1 year 1 second'} # 1 second so artifacts expire first, despite rounding errors
metadata:
owner: "${ownerEmail}"
source: '${repoUrl}/raw/${head_sha}/.taskcluster.yml'
name: Decision Task (${tasks_for})
description: Load, transform, optimize, and submit other tasks
provisionerId: proj-taskcluster
workerType: ci
scopes:
# `https://` is 8 characters so, ${repoUrl[8:]} is the repository without the protocol.
$if: 'tasks_for == "github-push" && event["ref"][:11] != "refs/tags/v"'
then:
$let:
short_head_branch:
$if: 'head_branch[:11] == "refs/heads/"'
then: {$eval: 'head_branch[11:]'}
else: ${head_branch}
in:
- 'assume:repo:${repoUrl[8:]}:branch:${short_head_branch}'
else:
$if: 'tasks_for == "github-pull-request"'
then:
- 'assume:repo:github.com/${event.pull_request.base.repo.full_name}:pull-request'
else:
$if: 'tasks_for == "github-push" && event["ref"][:11] == "refs/tags/v"'
then:
- 'assume:repo:${repoUrl[8:]}:tag:${head_branch[10:]}'
requires: all-completed
priority: highest
retries: 5
payload:
env:
# run-task uses these to check out the source; the inputs
# to `mach taskgraph decision` are all on the command line.
$merge:
- TASKCLUSTER_BASE_REPOSITORY: '${baseRepoUrl}'
TASKCLUSTER_HEAD_REPOSITORY: '${repoUrl}'
TASKCLUSTER_HEAD_REF: '${head_branch}'
TASKCLUSTER_HEAD_REV: '${head_sha}'
TASKCLUSTER_HEAD_TAG: '${head_tag}'
TASKCLUSTER_REPOSITORY_TYPE: git
TASKGRAPH_BASE_REPOSITORY: https://hg.mozilla.org/ci/taskgraph
TASKGRAPH_HEAD_REPOSITORY: https://hg.mozilla.org/ci/${taskgraph.branch}
TASKGRAPH_HEAD_REV: ${taskgraph.revision}
TASKGRAPH_REPOSITORY_TYPE: hg
REPOSITORIES: {$json: {taskcluster: "taskcluster", taskgraph: "Taskgraph"}}
HG_STORE_PATH: /builds/worker/checkouts/hg-store
- $if: 'tasks_for in ["github-pull-request"]'
then:
TASKCLUSTER_PULL_REQUEST_NUMBER: '${event.pull_request.number}'
features:
taskclusterProxy: true
# Note: This task is built server side without the context or tooling that
# exist in tree so we must hard code the hash
image:
mozillareleases/taskgraph:decision-d9fab4448ee5e00b0a29825c3f0609af957279daf102547d715414782710ef06
maxRunTime: 600
command:
- /usr/local/bin/run-task
- '--taskcluster-checkout=/builds/worker/checkouts/src'
- '--taskgraph-checkout=/builds/worker/checkouts/taskgraph'
- '--task-cwd=/builds/worker/checkouts/src'
- '--'
- bash
- -cx
- >
PIP_IGNORE_INSTALLED=0 pip install --user /builds/worker/checkouts/taskgraph &&
PIP_IGNORE_INSTALLED=0 pip install --user arrow taskcluster pyyaml &&
ln -s /builds/worker/artifacts artifacts &&
~/.local/bin/taskgraph decision
--pushlog-id='0'
--pushdate='0'
--project='${project}'
--message=""
--owner='${ownerEmail}'
--level='${level}'
--base-repository="$TASKCLUSTER_BASE_REPOSITORY"
--head-repository="$TASKCLUSTER_HEAD_REPOSITORY"
--head-ref="$TASKCLUSTER_HEAD_REF"
--head-rev="$TASKCLUSTER_HEAD_REV"
--head-tag="$TASKCLUSTER_HEAD_TAG"
--repository-type="$TASKCLUSTER_REPOSITORY_TYPE"
--target-tasks-method=taskcluster-branches
--tasks-for='${tasks_for}'
artifacts:
'public':
type: 'directory'
path: '/builds/worker/artifacts'
expires: {$fromNow: '1 year'}