-
Notifications
You must be signed in to change notification settings - Fork 148
/
.taskcluster.yml
171 lines (165 loc) · 7.98 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
---
version: 1
reporting: checks-v1
policy:
pullRequests: public
tasks:
- $let:
project: balrog
# Dependabot, and possibly other things creating pull requests
# can set `user` to something that can't be used in an e-mail
# address, so we simply make this static to workaround.
ownerEmail: 'release+balrog-ci@mozilla.com'
# Github events have this stuff in different places...
baseRepoUrl:
$if: 'tasks_for == "github-pull-request"'
then: '${event.pull_request.base.repo.html_url}'
else: '${event.repository.html_url}'
repoUrl:
$if: 'tasks_for == "github-pull-request"'
then: '${event.pull_request.head.repo.html_url}'
else: '${event.repository.html_url}'
head_branch:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.head.ref}
else:
$if: 'tasks_for == "github-push"'
then: ${event.ref}
else: ${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: '${event.release.tag_name}'
releaseAction:
$if: 'tasks_for == "github-release"'
then: ${event.action}
else: 'UNDEFINED'
ownTaskId: {$eval: as_slugid("decision_task")}
level:
$if: >
tasks_for in ["github-push", "github-release"]
then: '3'
else: '1'
trustDomain: releng
in:
$if: >
(tasks_for == "github-push" && head_branch == "refs/heads/main")
|| (tasks_for == "github-pull-request" && event.action in ["opened", "reopened", "synchronize"])
|| (tasks_for == "github-release" && releaseAction == "published")
then:
taskId: '${ownTaskId}'
taskGroupId: '${ownTaskId}' # same as taskId; this is how automation identifies a decision task
schedulerId: '${trustDomain}-level-${level}'
created: {$fromNow: ''}
deadline: {$fromNow: '1 day'}
expires: {$fromNow: '1 year 1 second'}
metadata:
owner: "${ownerEmail}"
source: '${repoUrl}/raw/${head_sha}/.taskcluster.yml'
name: "Decision Task"
description: 'The task that creates all of the other tasks in the task graph'
provisionerId: "${trustDomain}-${level}"
workerType: "decision-gcp"
tags:
kind: decision-task
routes:
$flatten:
- checks
- $if: 'tasks_for == "github-push"'
then:
- "index.${trustDomain}.v2.${project}.revision.${head_sha}.taskgraph.decision"
else: []
scopes:
# `https://` is 8 characters so, ${repoUrl[8:]} is the repository without the protocol.
$if: 'tasks_for == "github-push"'
then:
$let:
short_head_branch:
$if: 'head_branch[:10] == "refs/tags/"'
then: {$eval: 'head_branch[10:]'}
else:
$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-release"'
then:
- 'assume:repo:${repoUrl[8:]}:release:${releaseAction}'
requires: all-completed
priority: lowest
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:
- BALROG_BASE_REPOSITORY: '${baseRepoUrl}'
BALROG_HEAD_REPOSITORY: '${repoUrl}'
BALROG_HEAD_REF: '${head_branch}'
BALROG_HEAD_REV: '${head_sha}'
BALROG_REPOSITORY_TYPE: git
BALROG_PIP_REQUIREMENTS: taskcluster/requirements.txt
REPOSITORIES: {$json: {balrog: "Balrog"}}
- $if: 'tasks_for in ["github-pull-request"]'
then:
BALROG_PULL_REQUEST_NUMBER: '${event.pull_request.number}'
features:
taskclusterProxy: true
chainOfTrust: 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-c4ac262880970ca484105929e02dd12f00214d5f2603ab6ce4c0d17de5cd0280@sha256:2dd667994aa13fccdcdcede85c570a5eb4a5247e42875a9e95a135ef774ee469
maxRunTime: 1800
command:
- /usr/local/bin/run-task
- '--balrog-checkout=/builds/worker/checkouts/src'
- '--task-cwd=/builds/worker/checkouts/src'
- '--'
- bash
- -cx
- $let:
extraArgs:
$if: 'tasks_for == "github-release"'
then: '--head-tag="${event.release.tag_name}"'
else: ''
in:
ln -s /builds/worker/artifacts artifacts &&
~/.local/bin/taskgraph decision
--pushlog-id='0'
--pushdate='0'
--project='${project}'
--message=""
--owner='${ownerEmail}'
--level='${level}'
--base-repository="$BALROG_BASE_REPOSITORY"
--head-repository="$BALROG_HEAD_REPOSITORY"
--head-ref="$BALROG_HEAD_REF"
--head-rev="$BALROG_HEAD_REV"
--repository-type="$BALROG_REPOSITORY_TYPE"
--tasks-for='${tasks_for}'
--target-tasks-method=balrog
${extraArgs}
artifacts:
'public':
type: 'directory'
path: '/builds/worker/artifacts'
expires: {$fromNow: '1 year'}
'public/docker-contexts':
type: 'directory'
path: '/builds/worker/checkouts/src/docker-contexts'
# This needs to be at least the deadline of the
# decision task + the docker-image task deadlines.
# It is set to a week to allow for some time for
# debugging, but they are not useful long-term.
expires: {$fromNow: '7 day'}
extra:
tasks_for: '${tasks_for}'