-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy path.taskcluster.yml
217 lines (207 loc) · 8.42 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
version: 1
policy:
pullRequests: public
tasks:
$let:
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_rev:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.head.sha}
else:
$if: 'tasks_for == "github-push"'
then: ${event.after}
else: ${event.release.tag_name}
repository:
$if: 'tasks_for == "github-pull-request"'
then: ${event.pull_request.head.repo.html_url}
else: ${event.repository.html_url}
tag:
$if: 'tasks_for == "github-push"'
then:
$if: 'event.ref[:10] == "refs/tags/"'
then: {$eval: 'event.ref[10:]' }
else: "latest"
else: "latest"
in:
$flatten:
- $if: 'tasks_for == "github-push" || (tasks_for[:19] == "github-pull-request" && event.action in ["opened", "reopened", "synchronize"])'
then:
- taskId: {$eval: as_slugid("code_checks")}
provisionerId: proj-relman
workerType: generic-worker-ubuntu-24-04
created: {$fromNow: ''}
deadline: {$fromNow: '1 hour'}
payload:
maxRunTime: 3600
image: python:3.10
env:
GIT_REPOSITORY: ${repository}
GIT_REVISION: ${head_rev}
command:
- sh
- -lxce
- "git clone --quiet ${repository} /src && cd /src && git checkout ${head_rev} -b taskboot &&
pip install --no-cache-dir --quiet -r requirements-tests.txt . &&
pre-commit run -a --show-diff-on-failure && pytest -v"
metadata:
name: TaskBoot code checks
description: Taskcluster boot utilities - code linting & unit tests
owner: [email protected]
source: https://github.com/mozilla/task-boot
- taskId: {$eval: as_slugid("docker_build")}
dependencies:
- {$eval: as_slugid("code_checks")}
provisionerId: proj-relman
workerType: generic-worker-ubuntu-24-04
created: {$fromNow: ''}
deadline: {$fromNow: '1 hour'}
payload:
maxRunTime: 3600
env:
IMAGE: mozilla/taskboot
REGISTRY: registry.hub.docker.com
VERSION: "${tag}"
command:
- - sh
- '-lxce'
- |
python3 -m venv myenv
. myenv/bin/activate
pip install setuptools
git clone --quiet ${repository} src
cd src
git checkout ${head_rev} -b taskboot
pip install --no-cache-dir --quiet .
taskboot --target=. build --image=$${IMAGE} --tag=$${VERSION} --write ../image.tar Dockerfile
artifacts:
- name: public/taskboot/image.tar.zst
expires: {$fromNow: '2 weeks'}
path: image.tar.zst
type: file
metadata:
name: TaskBoot docker build
description: Taskcluster boot utilities - build latest docker image
owner: [email protected]
source: https://github.com/mozilla/task-boot
- taskId: {$eval: as_slugid("docker_build_test")}
dependencies:
- {$eval: as_slugid("code_checks")}
provisionerId: proj-relman
workerType: generic-worker-ubuntu-24-04
created: {$fromNow: ''}
deadline: {$fromNow: '1 hour'}
payload:
maxRunTime: 3600
env:
IMAGE: mozilla/taskboot
REGISTRY: registry.hub.docker.com
VERSION: "${tag}"
command:
- - sh
- '-lxce'
- |
python3 -m venv myenv
. myenv/bin/activate
pip install setuptools
git clone --quiet ${repository} src
cd src
git checkout ${head_rev} -b taskboot
pip install --no-cache-dir --quiet .
taskboot --target=. build --image=$${IMAGE} --tag=$${VERSION} --write ../image.tar tests/dockerfile.empty
artifacts:
- name: public/taskboot/test-podman.tar.zst
expires: {$fromNow: '2 weeks'}
path: image.tar.zst
type: file
metadata:
name: TaskBoot docker build (test image)
description: Taskcluster boot utilities - build a test image
owner: [email protected]
source: https://github.com/mozilla/task-boot
- taskId: {$eval: as_slugid("docker_run_podman")}
dependencies:
- {$eval: as_slugid("docker_build_test")}
provisionerId: proj-relman
workerType: generic-worker-ubuntu-24-04
created: {$fromNow: ''}
deadline: {$fromNow: '1 hour'}
payload:
maxRunTime: 3600
image:
type: task-image
path: public/taskboot/test-podman.tar.zst
taskId: {$eval: as_slugid("docker_build_test")}
metadata:
name: TaskBoot docker run podman image
description: Taskcluster boot utilities - run a test image
owner: [email protected]
source: https://github.com/mozilla/task-boot
- $if: 'tasks_for == "github-push" && (head_branch == "refs/heads/master" || head_branch[:10] == "refs/tags/")'
then:
taskId: {$eval: as_slugid("docker_push")}
dependencies:
- {$eval: as_slugid("docker_build")}
provisionerId: proj-relman
workerType: generic-worker-ubuntu-24-04
created: {$fromNow: ''}
deadline: {$fromNow: '1 hour'}
payload:
features:
# Needed for access to secret
taskclusterProxy: true
maxRunTime: 3600
image: python:3.10
env:
TASKCLUSTER_SECRET: project/relman/taskboot/deploy
command:
- sh
- -lxce
- "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list &&
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/Release.key | apt-key add - &&
apt-get -qq update && apt-get -qq install -y skopeo zstd &&
git clone --quiet ${repository} /src && cd /src && git checkout ${head_rev} -b taskboot &&
pip install --no-cache-dir --quiet . &&
taskboot push-artifact"
scopes:
- secrets:get:project/relman/taskboot/deploy
metadata:
name: TaskBoot docker push
description: Taskcluster boot utilities - push docker image
owner: [email protected]
source: https://github.com/mozilla/task-boot
- $if: 'tasks_for == "github-push" && head_branch[:10] == "refs/tags/"'
then:
taskId: {$eval: as_slugid("release")}
dependencies:
- {$eval: as_slugid("docker_push")}
provisionerId: proj-relman
workerType: generic-worker-ubuntu-24-04
created: {$fromNow: ''}
deadline: {$fromNow: '1 hour'}
payload:
features:
# Needed for access to secret
taskclusterProxy: true
maxRunTime: 3600
# Use the image just uploaded !
image: "mozilla/taskboot:${tag}"
env:
TASKCLUSTER_SECRET: project/relman/taskboot/deploy
command:
- taskboot
- github-release
- mozilla/task-boot
- "${tag}"
scopes:
- secrets:get:project/relman/taskboot/deploy
metadata:
name: "TaskBoot github release ${tag}"
description: Taskcluster boot utilities - ship a new release
owner: [email protected]
source: https://github.com/mozilla/task-boot