Skip to content

bluebox CI/CD example #289

bluebox CI/CD example

bluebox CI/CD example #289

Workflow file for this run

name: 'bluebox CI/CD example'
on:
schedule:
# Run job once a week on saturday at 8:15 AM.
- cron: '15 8 * * 6'
push:
branches: [ main ]
pull_request:
branches: [ '**' ]
jobs:
build-initramfs:
runs-on: ubuntu-latest
steps:
- name: checkout bluebox
uses: actions/checkout@v4
- name: set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
id: go
- name: build initramfs
# Instead of installing bluebox with 'go install github.com/florianl/bluebox@VERSION' we
# just compile the code here and execute the resulting binary.
run: |
go build .
./bluebox
- name: upload initramfs for tests
# Upload the generated initramfs.cpio and make it available for the parallel per-kernel tests.
uses: actions/upload-artifact@v4
with:
name: initramfs
path: |
initramfs.cpio
per-kernel-tests:
needs: build-initramfs
runs-on: ubuntu-latest
strategy:
matrix:
kernel-version: ["4.9", "4.14", "4.19", "5.4", "5.10", "5.15", "6.1", "6.6", "6.7", "6.8", "6.9"]
steps:
- name: add Docker repo
run: |
# From https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
- name: install dependencies
# Make sure required software packages are available.
run: |
sudo apt --yes update
sudo apt --yes install --no-install-recommends qemu-system-x86 docker-buildx-plugin
- name: get initramfs
# Fetch the initramfs.cpio that was created in the previous step.
uses: actions/download-artifact@v4
with:
name: initramfs
- name: fetch and unpack Linux kernel
# Fetch the public kernel image that will be used in this test run.
# Inspired by extract_oci_image from cilium/ebpf.
run: |
mkdir /tmp/ci-kernel
echo "FROM ghcr.io/cilium/ci-kernels:${{ matrix.kernel-version }}" | docker buildx build --quiet --pull --output="/tmp/ci-kernel" -
- name: run tests on kernel
# Run the tests.
run: |
qemu-system-x86_64 -nographic -append "console=ttyS0" -m 2G -kernel /tmp/ci-kernel/boot/vmlinuz -initrd initramfs.cpio