Skip to content

Commit e0ba112

Browse files
henrywangclaude
andauthored
staged-images: Add bcvk boot test before publishing (#153)
Boot each staged image in a VM using bcvk ephemeral and run `bootc status` to verify the image is functional before pushing. The test only runs on amd64 (GitHub arm64 runners lack /dev/kvm). For PRs, skip mirror/push/manifest — only build and test. Assisted-by: Claude Code (Opus 4.6) Signed-off-by: Xiaofeng Wang <henrywangxf@me.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a6b8b17 commit e0ba112

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

.github/workflows/build-staged-images.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
paths:
77
- 'staged-images/**'
88
- '.github/workflows/build-staged-images.yml'
9+
pull_request:
10+
branches: [main]
11+
paths:
12+
- 'staged-images/**'
13+
- '.github/workflows/build-staged-images.yml'
914
schedule:
1015
# Rebuild weekly to pick up upstream base image updates
1116
- cron: '0 6 * * 1'
@@ -18,6 +23,9 @@ concurrency:
1823
env:
1924
REGISTRY: ghcr.io
2025

26+
# Job flow:
27+
# PR: generate-matrix → build + test
28+
# push/schedule: generate-matrix → mirror → build + test → push → manifest
2129
jobs:
2230
# Read sources.json and generate matrices for downstream jobs.
2331
generate-matrix:
@@ -42,6 +50,7 @@ jobs:
4250
mirror:
4351
name: Mirror ${{ matrix.name }}:${{ matrix.tag }}
4452
needs: generate-matrix
53+
if: github.event_name != 'pull_request'
4554
runs-on: ubuntu-24.04
4655
permissions:
4756
contents: read
@@ -75,27 +84,41 @@ jobs:
7584
steps:
7685
- uses: actions/checkout@v6
7786
- uses: bootc-dev/actions/bootc-ubuntu-setup@main
87+
with:
88+
libvirt: ${{ matrix.arch == 'amd64' }}
7889
- name: Log in to GHCR
90+
if: github.event_name != 'pull_request'
7991
run: |
8092
echo "${{ secrets.GITHUB_TOKEN }}" | \
8193
podman login -u "${{ github.actor }}" --password-stdin ${{ env.REGISTRY }}
8294
- name: Build staged image
8395
run: just staged-images/build ${{ matrix.image_key }}
8496
env:
85-
SOURCE_FROM_MIRROR: "1"
97+
SOURCE_FROM_MIRROR: ${{ github.event_name != 'pull_request' && '1' || '' }}
8698
REGISTRY_OWNER: ${{ github.repository_owner }}
99+
# Smoke-test: boot the image in a VM and verify all systemd services
100+
# started successfully. This catches images broken by rechunking.
101+
# Only amd64 — GitHub arm64 runners lack /dev/kvm (no nested KVM).
102+
- name: Boot and test staged image
103+
if: matrix.arch == 'amd64'
104+
run: |
105+
image="localhost/${{ matrix.name }}:${{ matrix.tag }}"
106+
bcvk ephemeral run-ssh "${image}" -- systemctl is-system-running
87107
- name: Push by digest
108+
if: github.event_name != 'pull_request'
88109
id: push
89110
run: |
90111
digest=$(just staged-images/push ${{ matrix.image_key }} ${{ matrix.arch }})
91112
echo "digest=${digest}" >> "$GITHUB_OUTPUT"
92113
env:
93114
REGISTRY_OWNER: ${{ github.repository_owner }}
94115
- name: Upload digest artifact
116+
if: github.event_name != 'pull_request'
95117
run: |
96118
mkdir -p "${{ runner.temp }}/digests"
97119
echo "${{ steps.push.outputs.digest }}" > "${{ runner.temp }}/digests/${{ matrix.arch }}"
98120
- uses: actions/upload-artifact@v7
121+
if: github.event_name != 'pull_request'
99122
with:
100123
name: staged-digests-${{ matrix.name }}-${{ matrix.tag }}-${{ matrix.arch }}
101124
path: ${{ runner.temp }}/digests/*
@@ -105,7 +128,7 @@ jobs:
105128
manifest:
106129
name: Manifest ${{ matrix.name }}:${{ matrix.tag }}
107130
needs: [generate-matrix, build]
108-
if: ${{ !cancelled() }}
131+
if: ${{ !cancelled() && github.event_name != 'pull_request' }}
109132
runs-on: ubuntu-24.04
110133
permissions:
111134
contents: read

0 commit comments

Comments
 (0)