Skip to content

eBPF-based security platform

ci: retry the provision of the LVH VM

John Fastabendd6d3ac535f17
diff --git a/.github/actions/lvh/action.yml b/.github/actions/lvh/action.yml
new file mode 100644
index 00000000..c21d8a65
--- /dev/null
+++ b/.github/actions/lvh/action.yml
@@ -0,0 +1,115 @@
+# SPDX-License-Identifier: BSD-2-Clause
+# Copyright (c) 2026 Authors of shirudo
+#
+# Run a command in an LVH VM, as cilium/little-vm-helper does, but try
+# up to three times to bring the VM up. The helper pulls the VM image and
+# the kernel from quay.io once and fails the job on the first error, and
+# a pull that ends early is the commonest way these jobs fail. The inputs
+# are the helper's, and a job checks the repository out before it uses
+# this action.
+name: LVH VM
+description: Run a command in an LVH VM, retrying its provision
+
+inputs:
+ test-name:
+ description: Unique test name
+ required: true
+ image:
+ description: LVH image name
+ required: true
+ image-version:
+ description: LVH image version
+ required: true
+ kernel-version:
+ description: Kernel version
+ required: true
+ host-mount:
+ description: Host directory to mount at /host in the VM
+ required: true
+ images-folder-parent:
+ description: Parent directory of the downloaded images
+ required: true
+ install-dependencies:
+ description: Install QEMU dependencies
+ required: true
+ cmd:
+ description: Commands to run in the VM, each "$" in them escaped
+ required: true
+ ssh-port:
+ description: SSH port of the VM on the host
+ required: false
+ default: '2222'
+ cpu:
+ description: CPU count
+ required: false
+ mem:
+ description: RAM size
+ required: false
+
+runs:
+ using: composite
+ steps:
+ # An attempt without a command provisions the VM and runs nothing.
+ - name: Provision the LVH VM
+ id: first
+ continue-on-error: true
+ uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ with:
+ test-name: ${{ inputs.test-name }}
+ image: ${{ inputs.image }}
+ image-version: ${{ inputs.image-version }}
+ kernel-version: ${{ inputs.kernel-version }}
+ host-mount: ${{ inputs.host-mount }}
+ images-folder-parent: ${{ inputs.images-folder-parent }}
+ install-dependencies: ${{ inputs.install-dependencies }}
+ ssh-port: ${{ inputs.ssh-port }}
+ cpu: ${{ inputs.cpu }}
+ mem: ${{ inputs.mem }}
+
+ - name: Provision the LVH VM, second attempt
+ id: second
+ if: steps.first.outcome == 'failure'
+ continue-on-error: true
+ uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ with:
+ test-name: ${{ inputs.test-name }}
+ image: ${{ inputs.image }}
+ image-version: ${{ inputs.image-version }}
+ kernel-version: ${{ inputs.kernel-version }}
+ host-mount: ${{ inputs.host-mount }}
+ images-folder-parent: ${{ inputs.images-folder-parent }}
+ install-dependencies: ${{ inputs.install-dependencies }}
+ ssh-port: ${{ inputs.ssh-port }}
+ cpu: ${{ inputs.cpu }}
+ mem: ${{ inputs.mem }}
+
+ - name: Provision the LVH VM, last attempt
+ if: steps.second.outcome == 'failure'
+ uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ with:
+ test-name: ${{ inputs.test-name }}
+ image: ${{ inputs.image }}
+ image-version: ${{ inputs.image-version }}
+ kernel-version: ${{ inputs.kernel-version }}
+ host-mount: ${{ inputs.host-mount }}
+ images-folder-parent: ${{ inputs.images-folder-parent }}
+ install-dependencies: ${{ inputs.install-dependencies }}
+ ssh-port: ${{ inputs.ssh-port }}
+ cpu: ${{ inputs.cpu }}
+ mem: ${{ inputs.mem }}
+
+ - name: Run the command in the LVH VM
+ uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ with:
+ provision: 'false'
+ test-name: ${{ inputs.test-name }}
+ image: ${{ inputs.image }}
+ image-version: ${{ inputs.image-version }}
+ kernel-version: ${{ inputs.kernel-version }}
+ host-mount: ${{ inputs.host-mount }}
+ images-folder-parent: ${{ inputs.images-folder-parent }}
+ install-dependencies: ${{ inputs.install-dependencies }}
+ ssh-port: ${{ inputs.ssh-port }}
+ cpu: ${{ inputs.cpu }}
+ mem: ${{ inputs.mem }}
+ cmd: ${{ inputs.cmd }}
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 94662537..c1a6d2de 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,7 +1,9 @@
version: 2
updates:
- package-ecosystem: "github-actions"
- directory: "/"
+ directories:
+ - "/"
+ - "/.github/actions/lvh"
schedule:
interval: "weekly"
- package-ecosystem: "docker"
diff --git a/.github/workflows/build-commits.yml b/.github/workflows/build-commits.yml
index 7f394843..9349576d 100644
--- a/.github/workflows/build-commits.yml
+++ b/.github/workflows/build-commits.yml
@@ -33,7 +33,7 @@ jobs:
# same LVH VM as the package build. The guest does not inherit the
# runner's environment; GITHUB_ACTIONS is set for the annotations.
- name: Build every commit the pull request or push adds in LVH VM
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-build-commits
image: kind
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 4e7a4f07..928e9089 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -37,7 +37,7 @@ jobs:
# The BPF objects need the BTF of a signed-BPF capable bpf-next
# kernel, so the build runs in the same LVH VM as the package build.
- name: Build with ${{ matrix.cc }} and run the unit tests in LVH VM
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-build-${{ matrix.cc }}
image: kind
@@ -67,10 +67,17 @@ jobs:
timeout-minutes: 30
steps:
+ # The job needs the action alone.
+ - name: Check out the LVH action
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ sparse-checkout: .github/actions
+ persist-credentials: false
+
# The BTF of the bpf-next kernel the other builds run on, for the
# builds that cannot boot it themselves.
- name: Copy the kernel BTF out of the LVH VM
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-btf
image: kind
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 0c22fe93..61421f45 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -21,10 +21,17 @@ jobs:
timeout-minutes: 30
steps:
+ # The job needs the action alone.
+ - name: Check out the LVH action
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ sparse-checkout: .github/actions
+ persist-credentials: false
+
# The BTF of the bpf-next kernel the build generates vmlinux.h from,
# as the Build workflow takes it.
- name: Copy the kernel BTF out of the LVH VM
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-codeql-btf
image: kind
diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml
index 9c19440a..21ae9228 100644
--- a/.github/workflows/coverity.yml
+++ b/.github/workflows/coverity.yml
@@ -45,7 +45,7 @@ jobs:
# the host mount because the guest disk is small.
- name: Build under cov-build in LVH VM and upload the result
if: env.COVERITY_SCAN_TOKEN != ''
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-coverity
image: kind
diff --git a/.github/workflows/kernel-obs.yml b/.github/workflows/kernel-obs.yml
index 3d2f51ec..a5acc54d 100644
--- a/.github/workflows/kernel-obs.yml
+++ b/.github/workflows/kernel-obs.yml
@@ -140,7 +140,7 @@ jobs:
"$KERNEL_OBS_REGISTRY_TOKEN" > .ci/kernel-obs-registry-credentials
- name: Build and publish BPM package in LVH
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-kernel-obs
image: kind
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index e29c2a9d..c8120373 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -63,7 +63,7 @@ jobs:
# dependencies, which the toolchain of the LVH guest the other
# builds use provides.
- name: Run sparse over the userspace sources in LVH VM
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-sparse
image: kind
diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml
index c029b91c..68dbebe0 100644
--- a/.github/workflows/packages.yml
+++ b/.github/workflows/packages.yml
@@ -55,7 +55,7 @@ jobs:
key: lvh-target-deps-kind-bpf-next-20260603.072225-${{ hashFiles('.github/scripts/lvh-target-deps.sh') }}
- name: Build installer tarballs and deb package in LVH VM
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-apt
image: kind
@@ -265,7 +265,7 @@ jobs:
key: lvh-target-deps-kind-bpf-next-20260603.072225-${{ hashFiles('.github/scripts/lvh-target-deps.sh') }}
- name: Build the target RPM and BPF header in LVH
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-rpm-target
image: kind
diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml
index ad67ab20..83b128aa 100644
--- a/.github/workflows/sanitizers.yml
+++ b/.github/workflows/sanitizers.yml
@@ -55,7 +55,7 @@ jobs:
# capable bpf-next kernel, so the build runs in the same LVH VM as the
# package build. The host-side suite itself needs no root, LSM or TPM.
- name: Build with sanitizers and run the host-side suite in LVH VM
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-sanitizers-${{ matrix.compiler }}-${{ matrix.sanitize == 'thread' && 'tsan' || 'asan' }}
image: kind
@@ -122,7 +122,7 @@ jobs:
# or a pull request gets a minute per fuzz target, a run by hand
# ten.
- name: Build under MSan and run the unit tests and fuzz targets in LVH VM
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-msan
image: kind
@@ -210,7 +210,7 @@ jobs:
# minute per target, a run by hand ten.
- name: Fuzz the parsers of input from outside the host in LVH VM
id: fuzz
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-libfuzzer
image: kind
@@ -289,7 +289,7 @@ jobs:
- name: Fuzz the parsers of input from outside the host with AFL++ in LVH VM
id: fuzz
- uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33
+ uses: ./.github/actions/lvh
with:
test-name: shirudo-afl-fuzz
image: kind