-
Notifications
You must be signed in to change notification settings - Fork 13
374 lines (351 loc) · 13.2 KB
/
vyos-rolling-nightly-build.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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
name: VyOS rolling nightly build
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
BUILD_BY:
description: 'Builder identifier (default: [email protected])'
default: ''
build_version:
description: 'Version number (default: 1.5-rolling-ISO8601-TIMESTAMP)'
default: ''
SKIP_SMOKETEST_RAID1:
description: 'Skip RAID1 Test'
required: true
type: boolean
default: false
SKIP_SMOKETEST_SYSTEM:
description: 'Skip CLI smoketest'
required: true
type: boolean
default: false
SKIP_SMOKETEST_CONFIG:
description: 'Skip config load test'
required: true
type: boolean
default: false
SKIP_SNAPSHOT_S3_UPLOAD:
description: 'Skip snapshot upload to S3'
required: true
type: boolean
default: false
SKIP_RELEASE_PUBLISHING:
description: 'Skip release publishing'
required: true
type: boolean
default: false
SKIP_SLACK_NOTIFICATIONS:
description: 'Skip Slack notifications'
required: true
type: boolean
default: false
SKIP_DOWNLOADS_PAGE_UPDATE:
description: 'Skip downloads page update'
required: true
type: boolean
default: false
env:
BUILD_BY: [email protected]
DEBIAN_MIRROR: http://deb.debian.org/debian/
VYOS_MIRROR: https://rolling-packages.vyos.net/current/
jobs:
build_iso:
runs-on: ubuntu-24.04
permissions:
contents: write
container:
image: vyos/vyos-build:current
options: --sysctl net.ipv6.conf.lo.disable_ipv6=0 --privileged
outputs:
build_version: ${{ steps.set_env_variables.outputs.build_version }}
steps:
### Initialization ###
- uses: actions/checkout@v4
- name: "Initialization: set env variables"
id: set_env_variables
run: |
set -x
if [ -n "${{ github.event.inputs.BUILD_BY }}" ]; then
echo "BUILD_BY=${{ github.event.inputs.BUILD_BY }}" >> $GITHUB_ENV
fi
if [ -z "${{ github.event.inputs.build_version }}" ]; then
echo "build_version=1.5-rolling-$(date -u +%Y%m%d%H%M)" >> $GITHUB_OUTPUT
else
echo "build_version=${{ github.event.inputs.build_version }}" >> $GITHUB_OUTPUT
fi
echo "TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV
echo "PREVIOUS_SUCCESS_BUILD_TIMESTAMP=$(cat version.json | jq -r '.[0].timestamp')" >> $GITHUB_ENV
- name: Clone vyos-build source code
uses: actions/checkout@v4
with:
repository: vyos/vyos-build
path: vyos-build
- name: Build generic ISO image
id: build_generic_iso
run: |
cd vyos-build
sudo --preserve-env ./build-vyos-image \
--architecture amd64 \
--build-by $BUILD_BY \
--build-type release \
--custom-package vyos-1x-smoketest \
--debian-mirror $DEBIAN_MIRROR \
--version ${{ steps.set_env_variables.outputs.build_version }} \
--vyos-mirror $VYOS_MIRROR \
generic
# move artifact one level up for minisign
mv build/vyos-${{ steps.set_env_variables.outputs.build_version }}-generic-amd64.iso ..
- name: Sign generic ISO image
shell: bash
run: |
echo "${{ secrets.minisign_private_key }}" > /tmp/minisign.key
echo ${{ secrets.minisign_password }} | $GITHUB_WORKSPACE/bin/minisign -s /tmp/minisign.key -Sm vyos-${{ steps.set_env_variables.outputs.build_version }}-generic-amd64.iso
echo "${{ secrets.minisign_public_key }}" > /tmp/minisign.pub
$GITHUB_WORKSPACE/bin/minisign -Vm vyos-${{ steps.set_env_variables.outputs.build_version }}-generic-amd64.iso -x vyos-${{ steps.set_env_variables.outputs.build_version }}-generic-amd64.iso.minisig -p /tmp/minisign.pub
rm /tmp/minisign.key /tmp/minisign.pub
- uses: actions/upload-artifact@v4
with:
name: vyos-${{ steps.set_env_variables.outputs.build_version }}-generic-amd64
path: vyos-${{ steps.set_env_variables.outputs.build_version }}-*
retention-days: 30
if-no-files-found: error
test_smoketest_cli:
needs: build_iso
runs-on: ubuntu-24.04
if: ${{ !inputs.SKIP_SMOKETEST_SYSTEM }}
container:
image: vyos/vyos-build:current
options: --sysctl net.ipv6.conf.lo.disable_ipv6=0 --privileged
steps:
# We need the test script from vyos-build repo
- name: Clone vyos-build source code
uses: actions/checkout@v4
with:
repository: vyos/vyos-build
- uses: actions/download-artifact@v4
with:
name: vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64
path: build
- name: VyOS CLI smoketests
id: test
shell: bash
run: |
set -e
ln -s vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64.iso build/live-image-amd64.hybrid.iso
sudo make test | tee smoketest_make_test.log
- uses: actions/upload-artifact@v4
with:
name: smoketest_make_test
path: smoketest_make_test.log
retention-days: 30
if-no-files-found: error
test_config_load:
needs: build_iso
runs-on: ubuntu-24.04
if: ${{ !inputs.SKIP_SMOKETEST_CONFIG }}
container:
image: vyos/vyos-build:current
options: --sysctl net.ipv6.conf.lo.disable_ipv6=0 --privileged
steps:
# We need the test script from vyos-build repo
- name: Clone vyos-build source code
uses: actions/checkout@v4
with:
repository: vyos/vyos-build
- uses: actions/download-artifact@v4
with:
name: vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64
path: build
- name: VyOS config load tests
id: test
shell: bash
run: |
set -e
ln -s vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64.iso build/live-image-amd64.hybrid.iso
sudo make testc | tee smoketest_make_testc.log
- uses: actions/upload-artifact@v4
with:
name: smoketest_make_testc
path: smoketest_make_testc.log
retention-days: 30
if-no-files-found: error
test_raid1_install:
needs: build_iso
runs-on: ubuntu-24.04
if: ${{ !inputs.SKIP_SMOKETEST_RAID1 }}
container:
image: vyos/vyos-build:current
options: --sysctl net.ipv6.conf.lo.disable_ipv6=0 --privileged
steps:
# We need the test script from vyos-build repo
- name: Clone vyos-build source code
uses: actions/checkout@v4
with:
repository: vyos/vyos-build
- uses: actions/download-artifact@v4
with:
name: vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64
path: build
- name: VyOS RAID1 installation tests
id: test
shell: bash
run: |
set -e
ln -s vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64.iso build/live-image-amd64.hybrid.iso
sudo make testraid | tee smoketest_make_testraid.log
- uses: actions/upload-artifact@v4
with:
name: smoketest_make_testraid
path: smoketest_make_testraid.log
retention-days: 30
if-no-files-found: error
test_encrypted_config_tpm:
needs: build_iso
runs-on: ubuntu-24.04
if: ${{ !inputs.SKIP_SMOKETEST_RAID1 }}
container:
image: vyos/vyos-build:current
options: --sysctl net.ipv6.conf.lo.disable_ipv6=0 --privileged
steps:
# We need the test script from vyos-build repo
- name: Clone vyos-build source code
uses: actions/checkout@v4
with:
repository: vyos/vyos-build
- uses: actions/download-artifact@v4
with:
name: vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64
path: build
- name: VyOS TPM encryption tests
id: test
shell: bash
run: |
set -e
ln -s vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64.iso build/live-image-amd64.hybrid.iso
sudo make testtpm | tee smoketest_make_testtpm.log
- uses: actions/upload-artifact@v4
with:
name: smoketest_make_testtpm
path: smoketest_make_testtpm.log
retention-days: 30
if-no-files-found: error
publish:
needs:
- test_config_load
- test_raid1_install
- test_smoketest_cli
- test_encrypted_config_tpm
- build_iso
runs-on: ubuntu-24.04
permissions:
contents: write
if: ${{ !inputs.SKIP_RELEASE_PUBLISHING }}
steps:
- uses: actions/checkout@v4
- name: Clone vyos-build source code
uses: actions/checkout@v4
with:
repository: vyos/vyos-build
path: vyos-build
- name: Clone vyos-1x source code
uses: actions/checkout@v4
with:
repository: vyos/vyos-1x
path: vyos-1x
- id: commit_ids
shell: bash
run: |
cd vyos-build
echo "CHANGELOG_COMMIT_VYOS_BUILD=$(git log --since "${{ env.PREVIOUS_SUCCESS_BUILD_TIMESTAMP }}" --format="%H" --reverse | head -n1)" >> $GITHUB_OUTPUT
cd ../vyos-1x
echo "CHANGELOG_COMMIT_VYOS_1X=$(git log --since "${{ env.PREVIOUS_SUCCESS_BUILD_TIMESTAMP }}" --format="%H" --reverse | head -n1)" >> $GITHUB_OUTPUT
- name: "Release publishing: generate changelog for vyos-1x"
id: generate_changelog_for_vyos-1x
uses: mikepenz/[email protected]
with:
owner: "vyos"
repo: "vyos-1x"
fetchReviewers: false
fromTag: ${{ steps.commit_ids.outputs.CHANGELOG_COMMIT_VYOS_1X }}
toTag: HEAD
configurationJson: |
{
"categories": [{"title": "", "labels": []}],
"template": "#{{CHANGELOG}}",
"pr_template": "- #{{TITLE}}\n - PR: vyos/vyos-1x##{{NUMBER}}"
}
- name: "Release publishing: generate changelog for vyos-build"
id: generate_changelog_for_vyos-build
uses: mikepenz/[email protected]
with:
owner: "vyos"
repo: "vyos-build"
fetchReviewers: false
fromTag: ${{ steps.commit_ids.outputs.CHANGELOG_COMMIT_VYOS_BUILD }}
toTag: HEAD
configurationJson: |
{
"categories": [{"title": "", "labels": []}],
"template": "#{{CHANGELOG}}",
"pr_template": "- #{{TITLE}}\n - PR: vyos/vyos-build##{{NUMBER}}"
}
- name: "Release publishing: generate CHANGELOG.md"
run: |
cat <<EOF > CHANGELOG.md
## vyos-1x
${{ steps.generate_changelog_for_vyos-1x.outputs.changelog }}
## vyos-build
${{ steps.generate_changelog_for_vyos-build.outputs.changelog }}
EOF
cat CHANGELOG.md
- name: "Release publishing: create version.json"
uses: jsdaniell/[email protected]
with:
name: "version.json"
json: |
[
{
"url": "https://github.com/vyos/vyos-rolling-nightly-builds/releases/download/vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64/vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64.iso",
"version": "${{ needs.build_iso.outputs.build_version }}",
"timestamp": "${{ env.TIMESTAMP }}"
}
]
- name: "Release publishing: check if the repository was modified during runtime to prevent autocommit failure"
id: check_if_the_repository_was_modified_during_runtime
run: |
sudo chown -R $(whoami):$(whoami) ./*
git pull --autostash --rebase
- name: "Release publishing: create autocommit and tag"
uses: stefanzweifel/git-auto-commit-action@v5
with:
tagging_message: ${{ needs.build_iso.outputs.build_version }}
commit_message: ${{ needs.build_iso.outputs.build_version }}
commit_author: "vyosbot <${{ env.BUILD_BY }}>"
- uses: actions/download-artifact@v4
with:
name: vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64
- name: "Release publishing: publish release"
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
tag_name: ${{ needs.build_iso.outputs.build_version }}
fail_on_unmatched_files: true
files: |
./vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64.iso
./vyos-${{ needs.build_iso.outputs.build_version }}-generic-amd64.iso.minisig
- uses: Nats-ji/[email protected]
with:
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
keep-count: 30
keep-old-minor-releases: false
update_download_page:
if: ${{ !inputs.SKIP_RELEASE_PUBLISHING }}
needs:
- publish
uses: vyos/community.vyos.net/.github/workflows/main.yml@production
with:
branch: production
secrets:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}