forked from bootc-dev/bootc
-
Notifications
You must be signed in to change notification settings - Fork 0
574 lines (503 loc) · 20.6 KB
/
Copy pathci.yml
File metadata and controls
574 lines (503 loc) · 20.6 KB
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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
# CI Workflow for bootc
#
# Core principles:
# - Everything done here should be easy to replicate locally. Most tasks
# should invoke `just <something>`. Read the Justfile for more explanation
# of this.
# - Most additions to this should be extending existing tasks; e.g.
# there's places for unit and integration tests already.
name: CI
permissions:
actions: read
contents: read
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize, reopened, labeled]
merge_group:
workflow_dispatch: {}
env:
CARGO_TERM_COLOR: always
# Something seems to be setting this in the default GHA runners, which breaks bcvk
# as the default runner user doesn't have access
LIBVIRT_DEFAULT_URI: "qemu:///session"
DEV_IMAGE: ghcr.io/bootc-dev/dev-bootc
# Retry parameters for `just build-fetch` (transient Koji/Copr/quay.io failures)
BOOTC_CI_RETRIES: "10"
BOOTC_CI_DELAY: "60"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Determine the OS matrix for CI jobs based on context:
# - merge_group / workflow_dispatch / ci/merge label: all OSes
# - ci/tier-1 label: centos-10 only (fast feedback on the primary target)
# - plain PR: no heavy jobs
compute-ci-level:
runs-on: ubuntu-24.04
outputs:
package_os_matrix: ${{ steps.matrix.outputs.package_os_matrix }}
integration_os_matrix: ${{ steps.matrix.outputs.integration_os_matrix }}
upgrade_os_matrix: ${{ steps.matrix.outputs.upgrade_os_matrix }}
run_heavy: ${{ steps.matrix.outputs.run_heavy }}
steps:
- name: Compute OS matrices
id: matrix
run: |
LABELS='${{ toJson(github.event.pull_request.labels.*.name) }}'
EVENT='${{ github.event_name }}'
if [[ "$EVENT" == "merge_group" || "$EVENT" == "workflow_dispatch" ]] \
|| echo "$LABELS" | jq -e 'index("ci/merge")' > /dev/null; then
# Full suite: all OSes
echo 'package_os_matrix=["fedora-43","fedora-44","fedora-45","centos-9","centos-10"]' >> "$GITHUB_OUTPUT"
echo 'integration_os_matrix=["fedora-43","fedora-44","centos-9","centos-10"]' >> "$GITHUB_OUTPUT"
echo 'upgrade_os_matrix=["fedora-44","centos-10"]' >> "$GITHUB_OUTPUT"
echo 'run_heavy=true' >> "$GITHUB_OUTPUT"
elif echo "$LABELS" | jq -e 'index("ci/tier-1")' > /dev/null; then
# Tier-1 only: centos-10
echo 'package_os_matrix=["centos-10"]' >> "$GITHUB_OUTPUT"
echo 'integration_os_matrix=["centos-10"]' >> "$GITHUB_OUTPUT"
echo 'upgrade_os_matrix=["centos-10"]' >> "$GITHUB_OUTPUT"
echo 'run_heavy=true' >> "$GITHUB_OUTPUT"
else
# Plain PR: skip heavy jobs entirely
echo 'package_os_matrix=[]' >> "$GITHUB_OUTPUT"
echo 'integration_os_matrix=[]' >> "$GITHUB_OUTPUT"
echo 'upgrade_os_matrix=[]' >> "$GITHUB_OUTPUT"
echo 'run_heavy=false' >> "$GITHUB_OUTPUT"
fi
# Run basic validation checks (linting, formatting, etc)
validate:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Bootc Ubuntu Setup
uses: bootc-dev/actions/bootc-ubuntu-setup@main
- name: Validate (default)
run: just validate
# Check for security vulnerabilities and license compliance
cargo-deny:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: EmbarkStudios/cargo-deny-action@v2
with:
log-level: warn
command: check -A duplicate bans sources licenses
# Test bootc installation scenarios and fsverity support
# TODO convert to be an integration test: this would also
# ensure we inherit the `package` job (and in theory
# this could be a proper matrix)
install-tests:
name: "Test install"
if: needs.compute-ci-level.outputs.run_heavy == 'true'
needs: compute-ci-level
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Bootc Ubuntu Setup
uses: bootc-dev/actions/bootc-ubuntu-setup@main
- name: Enable fsverity for /
run: sudo tune2fs -O verity $(findmnt -vno SOURCE /)
- name: Install utils
run: sudo apt -y install fsverity just
- name: Fetch external dependencies (with retry)
run: just build-fetch
- name: Integration tests
run: |
set -xeu
# Build images as regular user, then copy to root's podman storage
# This avoids cargo cache permission issues when running cargo as root
just build
just build-install-test-image
just copy-to-rootful localhost/bootc
just copy-to-rootful localhost/bootc-install
# Copy bound images (LBI) to root's storage for tests that need them
just copy-lbi-to-rootful
# Build test binaries before any sudo commands to avoid cargo permission issues
cargo build --release -p tests-integration
sudo podman build -t localhost/bootc-fsverity -f ci/Containerfile.install-fsverity
df -h /
sudo install -m 0755 target/release/tests-integration /usr/bin/bootc-integration-tests
sudo rm target -rf
df -h /
# The ostree-container tests
sudo podman run --privileged --pid=host -v /:/run/host -v $(pwd):/src:ro -v /var/tmp:/var/tmp \
--tmpfs /var/lib/containers \
-v /run/dbus:/run/dbus -v /run/systemd:/run/systemd localhost/bootc /src/crates/ostree-ext/ci/priv-integration.sh
# Nondestructive but privileged tests
sudo bootc-integration-tests host-privileged localhost/bootc-install
# Install tests
sudo bootc-integration-tests install-alongside localhost/bootc-install
# inspect system state after the install tests.
sudo lsblk
sudo mount
# system-reinstall-bootc tests
cargo build --release -p system-reinstall-bootc
# not sure why this is missing in the ubuntu image but just creating this directory allows the tests to pass
sudo mkdir -p /run/sshd
sudo install -m 0755 target/release/system-reinstall-bootc /usr/bin/system-reinstall-bootc
# These tests may mutate the system live so we can't run in parallel
sudo bootc-integration-tests system-reinstall localhost/bootc --test-threads=1
# And the fsverity case
sudo podman run --privileged --pid=host localhost/bootc-fsverity bootc install to-existing-root --stateroot=other \
--acknowledge-destructive --skip-fetch-check
# Crude cross check
sudo find /ostree/repo/objects -name '*.file' -type f | while read f; do
sudo fsverity measure $f >/dev/null
done
# Test that we can build documentation
docs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Bootc Ubuntu Setup
uses: bootc-dev/actions/bootc-ubuntu-setup@main
- name: Build mdbook
run: just build-mdbook
# Build packages for each test OS
package:
if: needs.compute-ci-level.outputs.run_heavy == 'true'
needs: compute-ci-level
strategy:
fail-fast: false
matrix:
test_os: ${{ fromJson(needs.compute-ci-level.outputs.package_os_matrix) }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Bootc Ubuntu Setup
uses: bootc-dev/actions/bootc-ubuntu-setup@main
- name: Setup env
run: |
BASE=$(just pullspec-for-os base ${{ matrix.test_os }})
echo "BOOTC_base=${BASE}" >> $GITHUB_ENV
- name: Build packages (and verify build system)
run: just check-buildsys
- name: Upload package artifacts
uses: actions/upload-artifact@v7
with:
name: packages-${{ matrix.test_os }}
path: target/packages/*.rpm
retention-days: 1
# Build bootc from source into a container image FROM each specified base `test_os`
# running unit and integration tests (using TMT, leveraging the support for nested virtualization
# in the GHA runners)
test-integration:
if: needs.compute-ci-level.outputs.run_heavy == 'true'
needs: [compute-ci-level, package]
strategy:
fail-fast: false
matrix:
test_os: ${{ fromJson(needs.compute-ci-level.outputs.integration_os_matrix) }}
variant: [ostree, composefs]
filesystem: ["ext4", "xfs"]
# TODO: Remove "grub" once "grub-cc" is stable
bootloader: ["grub", "grub-cc", "systemd"]
boot_type: ["bls", "uki"]
seal_state: ["sealed", "unsealed"]
exclude:
# https://github.com/bootc-dev/bootc/issues/1812
- test_os: centos-9
variant: composefs
- seal_state: "sealed"
boot_type: bls
- seal_state: "sealed"
bootloader: grub
- seal_state: "sealed"
filesystem: xfs
- seal_state: "unsealed"
filesystem: ext4
boot_type: uki # we still want to test ext4 unsealed bls
- bootloader: grub
boot_type: "uki"
# We only test filesystems for composefs to test if composefs backend will work on fs
# without fsverity
- variant: ostree
filesystem: ext4
- variant: ostree
boot_type: uki
- variant: ostree
bootloader: systemd
# For now only have grub-cc tests in F44
- test_os: fedora-45
bootloader: grub-cc
- test_os: fedora-43
bootloader: grub-cc
- test_os: centos-9
bootloader: grub-cc
- test_os: centos-10
bootloader: grub-cc
# Not in ostree
- variant: ostree
bootloader: grub-cc
# Not yet "sealed"
- bootloader: grub-cc
seal_state: sealed
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Bootc Ubuntu Setup
uses: bootc-dev/actions/bootc-ubuntu-setup@main
with:
libvirt: true
- name: Install tmt
run: pip install --user "tmt[provision-virtual]"
- name: Setup env
run: |
BASE=$(just pullspec-for-os base ${{ matrix.test_os }})
echo "BOOTC_base=${BASE}" >> $GITHUB_ENV
echo "RUST_BACKTRACE=full" >> $GITHUB_ENV
echo "RUST_LOG=debug" >> $GITHUB_ENV
echo "BOOTC_variant=${{ matrix.variant }}" >> $GITHUB_ENV
echo "BOOTC_filesystem=${{ matrix.filesystem }}" >> $GITHUB_ENV
echo "BOOTC_bootloader=${{ matrix.bootloader }}" >> $GITHUB_ENV
echo "BOOTC_boot_type=${{ matrix.boot_type }}" >> $GITHUB_ENV
echo "BOOTC_seal_state=${{ matrix.seal_state }}" >> $GITHUB_ENV
- name: Download package artifacts
uses: actions/download-artifact@v8
with:
name: packages-${{ matrix.test_os }}
path: target/packages/
- name: Fetch external dependencies (with retry)
run: BOOTC_SKIP_PACKAGE=1 just build-fetch
- name: Build container
run: |
BOOTC_SKIP_PACKAGE=1 just bootloader=$BOOTC_bootloader build
# Extra cross-check (duplicating the integration test) that we're using the right base
used_vid=$(podman run --rm localhost/bootc bash -c '. /usr/lib/os-release && echo ${ID}-${VERSION_ID}')
test ${{ matrix.test_os }} = "${used_vid}"
- name: Unit and container integration tests
run: just test-container
- name: Validate composefs digest (UKI only)
if: matrix.boot_type == 'uki'
run: just validate-composefs-digest
- name: Run TMT integration tests
run: |
if [[ "${{ matrix.variant }}" = composefs ]]; then
just test-composefs "${{ matrix.bootloader }}" "${{ matrix.filesystem }}" "${{ matrix.boot_type }}" "${{ matrix.seal_state }}"
else
just test-tmt integration
fi
just clean-local-images
- name: Disk usage summary
if: always()
run: |
echo "### Disk usage" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
df -h >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
- name: Archive TMT logs
if: always()
uses: actions/upload-artifact@v7
with:
name: "tmt-log-\
${{ matrix.test_os }}-\
${{ matrix.variant }}-\
${{ matrix.bootloader }}-\
${{ matrix.boot_type }}-\
${{ matrix.filesystem }}-\
${{ matrix.seal_state }}-\
${{ env.ARCH }}"
path: /var/tmp/tmt
# Test the upgrade path: boot from published base image, upgrade to locally-built image,
# then run readonly tests to verify the upgrade worked.
# Excluded: centos-9 (lacks systemd.extra-unit.* support needed for --bind-storage-ro)
test-upgrade:
if: needs.compute-ci-level.outputs.run_heavy == 'true'
needs: [compute-ci-level, package]
strategy:
fail-fast: false
matrix:
test_os: ${{ fromJson(needs.compute-ci-level.outputs.upgrade_os_matrix) }}
variant: [ostree, composefs]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Bootc Ubuntu Setup
uses: bootc-dev/actions/bootc-ubuntu-setup@main
with:
libvirt: true
- name: Install tmt
run: pip install --user "tmt[provision-virtual]"
- name: Setup env
run: |
BASE=$(just pullspec-for-os base ${{ matrix.test_os }})
echo "BOOTC_base=${BASE}" >> $GITHUB_ENV
echo "BOOTC_variant=${{ matrix.variant }}" >> $GITHUB_ENV
echo "BOOTC_SKIP_PACKAGE=1" >> $GITHUB_ENV
echo "RUST_BACKTRACE=full" >> $GITHUB_ENV
- name: Download package artifacts
uses: actions/download-artifact@v8
with:
name: packages-${{ matrix.test_os }}
path: target/packages/
- name: Fetch external dependencies (with retry)
run: just build-fetch
- name: Run upgrade test
run: just test-upgrade
- name: Disk usage summary
if: always()
run: |
echo "### Disk usage" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
df -h >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
- name: Archive TMT logs
if: always()
uses: actions/upload-artifact@v7
with:
name: "tmt-log-${{ matrix.test_os }}-${{ matrix.variant }}-upgrade-${{ env.ARCH }}"
path: /var/tmp/tmt
# Test readonly behaviour with baseconfigs (transient mounts) baked into the image.
# Composefs-only: setup-root-conf.toml is a composefs concept; ostree uses a
# different config format (prepare-root.conf) and is not covered here.
# Runs once per distro × baseconfig — no bootloader/filesystem/boot_type matrix.
test-baseconfigs:
if: needs.compute-ci-level.outputs.run_heavy == 'true'
needs: [compute-ci-level, package]
strategy:
fail-fast: false
matrix:
test_os: ${{ fromJson(needs.compute-ci-level.outputs.integration_os_matrix) }}
baseconfigs: ["etc-transient", "root-transient", "var-volatile"]
exclude:
# centos-9 ships an older dracut that lacks the auto-install of setup-root-conf.toml
- test_os: centos-9
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Bootc Ubuntu Setup
uses: bootc-dev/actions/bootc-ubuntu-setup@main
with:
libvirt: true
- name: Install tmt
run: pip install --user "tmt[provision-virtual]"
- name: Setup env
run: |
BASE=$(just pullspec-for-os base ${{ matrix.test_os }})
echo "BOOTC_base=${BASE}" >> $GITHUB_ENV
echo "BOOTC_variant=composefs" >> $GITHUB_ENV
echo "BOOTC_baseconfigs=${{ matrix.baseconfigs }}" >> $GITHUB_ENV
echo "RUST_BACKTRACE=full" >> $GITHUB_ENV
- name: Download package artifacts
uses: actions/download-artifact@v8
with:
name: packages-${{ matrix.test_os }}
path: target/packages/
- name: Build container with baseconfig
run: BOOTC_SKIP_PACKAGE=1 just build
- name: Build upgrade image
run: just _build-upgrade-image
- name: Run TMT readonly tests
run: |
cargo xtask run-tmt \
--env=BOOTC_variant=composefs \
--env=BOOTC_baseconfigs=${{ matrix.baseconfigs }} \
--composefs-backend --bootloader=grub --filesystem=ext4 \
--seal-state=unsealed --boot-type=bls \
--upgrade-image=localhost/bootc-upgrade \
localhost/bootc readonly
just clean-local-images
- name: Disk usage summary
if: always()
run: |
echo "### Disk usage" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
df -h >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
- name: Archive TMT logs
if: always()
uses: actions/upload-artifact@v7
with:
name: "tmt-log-${{ matrix.test_os }}-composefs-baseconfigs-${{ matrix.baseconfigs }}-${{ env.ARCH }}"
path: /var/tmp/tmt
# Test bootc install on Fedora CoreOS (separate job to avoid disk space issues
# when run in the same job as test-integration).
# Uses fedora-43 as it's the current stable Fedora release matching CoreOS.
test-coreos:
# https://github.com/ostreedev/ostree/pull/3571 broke this because /boot
# without a separate /boot partition isn't mounted in the initramfs anymore.
# We need to change to use coreos-assembler.
if: false
needs: [compute-ci-level, package]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Bootc Ubuntu Setup
uses: bootc-dev/actions/bootc-ubuntu-setup@main
with:
libvirt: true
- name: Install tmt
run: pip install --user "tmt[provision-virtual]"
- name: Setup env
run: |
BASE=$(just pullspec-for-os base fedora-43)
echo "BOOTC_base=${BASE}" >> $GITHUB_ENV
echo "BOOTC_variant=ostree" >> $GITHUB_ENV
- name: Download package artifacts
uses: actions/download-artifact@v8
with:
name: packages-fedora-43
path: target/packages/
- name: Build container and test on CoreOS
run: |
BOOTC_SKIP_PACKAGE=1 just build
just build-testimage-coreos target/packages
just test-tmt-on-coreos plan-bootc-install-on-coreos
just clean-local-images
- name: Archive TMT logs
if: always()
uses: actions/upload-artifact@v7
with:
name: tmt-log-fedora-43-coreos-${{ env.ARCH }}
path: /var/tmp/tmt
# Test the container export -> Anaconda liveimg install path.
# Builds localhost/bootc, exports as tarball, installs via Anaconda in QEMU,
# and verifies the resulting disk boots.
test-container-export:
if: needs.compute-ci-level.outputs.run_heavy == 'true'
needs: [compute-ci-level, package]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Bootc Ubuntu Setup
uses: bootc-dev/actions/bootc-ubuntu-setup@main
with:
libvirt: true
- name: Setup env
run: |
echo "BOOTC_base=quay.io/centos-bootc/centos-bootc:stream10" >> $GITHUB_ENV
- name: Download package artifacts
uses: actions/download-artifact@v8
with:
name: packages-centos-10
path: target/packages/
- name: Build and run container export test
run: |
BOOTC_SKIP_PACKAGE=1 just test-container-export
- name: Archive test logs
if: always()
uses: actions/upload-artifact@v7
with:
name: container-export-test-${{ env.ARCH }}
path: target/anaconda-test/*.log
# Sentinel job for required checks - configure this job name in repository settings.
# Accepts 'skipped' as success so that merge_group-only jobs don't block PRs.
required-checks:
if: always()
needs: [compute-ci-level, cargo-deny, validate, install-tests, docs, package, test-integration, test-upgrade, test-baseconfigs, test-container-export]
runs-on: ubuntu-latest
steps:
- name: Check all jobs
env:
NEEDS: ${{ toJson(needs) }}
run: |
FAILED=$(echo "$NEEDS" | jq -r 'to_entries[] | select(.value.result | IN("success","skipped") | not) | .key')
if [ -n "$FAILED" ]; then
echo "The following jobs did not succeed: $FAILED"
exit 1
fi