-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipeline.yml
268 lines (268 loc) · 8.85 KB
/
pipeline.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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
jobs:
- name: build-tasmota-builder
plan:
- get: platformio-release
trigger: true
params: { include_source_tarball: false }
- load_var: platformio-version
file: platformio-release/version
- in_parallel:
- get: lib
trigger: false
- get: oci-task-image
- get: tasmota-builder-image-source
trigger: true
- task: build-image
privileged: true
file: lib/tasks/oci/build-image.yml
image: oci-task-image
input_mapping: { source: tasmota-builder-image-source }
params:
CONTEXT: source/images/tasmota-builder
BUILD_ARG_PLATFORM_IO_VERSION: ((.:platformio-version))
output_mapping: { image: image }
- load_var: image-source-version
file: tasmota-builder-image-source/.git/describe_ref # populated by the git-resource
- put: tasmota-builder-image
params:
image: image/image.tar
version: ((.:image-source-version))
bump_aliases: true
- name: build-jo
plan:
- get: jo-release
trigger: true
params: { include_source_tarball: true }
- load_var: jo-version
file: jo-release/version
- in_parallel:
- get: lib
trigger: false
- get: oci-task-image
- task: untar-source
file: lib/tasks/untar.yml
input_mapping: { release: jo-release }
output_mapping: { extracted: jo-source }
params: { tarball: source.tar.gz }
- get: alpine-image
- task: canonicalize-source
image: alpine-image
config:
platform: linux
inputs: [ name: jo-source ]
outputs: [ name: jo-source ]
run:
path: sh
args:
- -c
- |
mv jo-source/jpmens-jo-* jo-source/jpmens-jo
- task: build-image
privileged: true
file: lib/tasks/oci/build-image.yml
image: oci-task-image
input_mapping: { source: jo-source }
params: { CONTEXT: source/jpmens-jo }
output_mapping: { image: image }
- put: jo-image
params:
image: image/image.tar
version: ((.:jo-version))
bump_aliases: true
- name: build-release
plan:
- in_parallel:
- get: tasmota-release
trigger: true
params: { include_source_tarball: true }
- get: lib
- task: untar-tasmota-source
file: lib/tasks/untar.yml
input_mapping: { release: tasmota-release }
output_mapping: { extracted: tasmota-source }
params: { tarball: source.tar.gz }
- get: tasmota-builder-image
# TODO Build across a map of name => []buildFlag, e.g.
# {
# minimal: [ FIRMWARE_MINIMAL ],
# prometheus: [ USE_PROMETHEUS ],
# }
- in_parallel:
- do:
- task: build-minimal
image: tasmota-builder-image
config:
platform: linux
inputs: [ name: tasmota-source ]
params:
PLATFORMIO_CORE_DIR: pio-core
PLATFORMIO_BUILD_FLAGS: -DFIRMWARE_MINIMAL
caches: [ path: pio-core ]
outputs: [ name: firmware-minimal ]
run:
path: sh
args:
- -c
- |
PLATFORMIO_CORE_DIR=$(readlink -f "$PLATFORMIO_CORE_DIR")
echo Now we have "$(pio --version)" with core_dir of size "$(du -hs $PLATFORMIO_CORE_DIR)"
pio run --environment tasmota --project-dir tasmota-source/arendst-Tasmota-*/
cp tasmota-source/arendst-Tasmota-*/.pio/build/tasmota/firmware.bin firmware-minimal
gzip -9 firmware-minimal/firmware.bin
- put: firmware-minimal
params:
file: firmware-minimal/firmware.bin.gz
acl: public-read # https://stackoverflow.com/a/74522101/1044029 and https://github.com/concourse/s3-resource?tab=readme-ov-file#plan
- do:
- task: build-prometheus
image: tasmota-builder-image
config:
platform: linux
inputs: [ name: tasmota-source ]
params:
PLATFORMIO_CORE_DIR: pio-core
PLATFORMIO_BUILD_FLAGS: -DUSE_PROMETHEUS
caches: [ path: pio-core ]
outputs: [ name: firmware ]
run:
path: sh
args:
- -c
- |
PLATFORMIO_CORE_DIR=$(readlink -f "$PLATFORMIO_CORE_DIR")
echo Now we have "$(pio --version)" with core_dir of size "$(du -hs $PLATFORMIO_CORE_DIR)"
pio run --environment tasmota --project-dir tasmota-source/arendst-Tasmota-*/
cp tasmota-source/arendst-Tasmota-*/.pio/build/tasmota/firmware.bin firmware
gzip -9 firmware/firmware.bin
- put: firmware
params:
file: firmware/firmware.bin.gz
acl: public-read # https://stackoverflow.com/a/74522101/1044029 and https://github.com/concourse/s3-resource?tab=readme-ov-file#plan
- put: tasmota-builder-release
params:
name: tasmota-release/version
# body: release-notes/commits-since-last-tag.txt
tag: tasmota-release/tag
globs:
- firmware-minimal/tasmota-minimal.bin.gz
- firmware/tasmota.bin.gz
- get: jo-image
- task: prepare-notification
image: jo-image
config:
platform: linux
inputs: [ name: tasmota-builder-release ]
outputs: [ name: release-notification ]
run:
path: sh
args:
- -c
- |
jo \
topic=suhlig \
title="Tasmota Builder" \
message="The new Tasmota firmware build $(cat tasmota-builder-release/tag) is available." \
"actions[]=$(jo action=view label=Pipeline url='$ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME')" \
"actions[]=$(jo action=view label=Release url=$(cat tasmota-builder-release/url))" \
| tee release-notification/message.json
- put: ntfy
params: { file: release-notification/message.json }
resources:
- name: lib
type: git
icon: file-tree
source: &github
uri: git@github.com:suhlig/concourse-task-library.git
private_key: ((secrets.github.ssh_key))
- name: tasmota-builder-image-source
type: git
icon: github
source:
<<: *github
uri: git@github.com:uhlig-it/tasmota-builder.git
paths: [ images/tasmota-builder/* ]
- name: platformio-release
type: github-release
icon: package
source: &github-release
owner: platformio
repository: platformio-core
access_token: ((secrets.github.access_token))
pre_release: false
- name: tasmota-release
type: github-release
icon: package
source:
<<: *github-release
owner: arendst
repository: Tasmota
pre_releases: false
- name: tasmota-builder-image
type: registry-image
icon: docker
source: &dockerhub
repository: uhligit/tasmota-builder
username: ((secrets.dockerhub.username))
password: ((secrets.dockerhub.authtoken))
pre_releases: false
debug: false
tag: latest
- name: oci-task-image
type: registry-image
icon: docker
source:
<<: *dockerhub
repository: concourse/oci-build-task
- name: jo-image
type: registry-image
icon: docker
source:
<<: *dockerhub
repository: uhligit/jo
- name: alpine-image
type: registry-image
icon: docker
source:
<<: *dockerhub
repository: alpine
- name: firmware
type: s3
source: &s3
bucket: uhlig-it-tasmota-builds
versioned_file: tasmota.bin.gz
access_key_id: ((secrets.b2.keyID))
secret_access_key: ((secrets.b2.applicationKey))
endpoint: s3.us-west-001.backblazeb2.com
- name: firmware-minimal
type: s3
source:
<<: *s3
versioned_file: tasmota-minimal.bin.gz
- name: tasmota-builder-release
type: github-release
icon: github-circle
source:
<<: *github-release
owner: uhlig-it
repository: tasmota-builder # concourse-uhlig-it must have write access
pre_release: false
drafts: false
- name: jo-release
type: github-release
icon: github-circle
source:
<<: *github-release
owner: jpmens
repository: jo
pre_release: false
drafts: false
- name: ntfy
type: http-resource
source:
url: https://ntfy.sh
build_metadata: [ body ]
out_only: true
resource_types:
- name: http-resource
type: docker-image
source: { repository: jgriff/http-resource }