ci: add GitHub Action to build the kvm_x86_64 ONIE image#1
Closed
bhouse-nexthop wants to merge 1 commit into
Closed
ci: add GitHub Action to build the kvm_x86_64 ONIE image#1bhouse-nexthop wants to merge 1 commit into
bhouse-nexthop wants to merge 1 commit into
Conversation
Add a GitHub Actions workflow that builds the generic amd64 ONIE target
(kvm_x86_64, intended to run as a VM under KVM/QEMU) on every push and
pull request that touches the build. The intent is to make reviewing
other PRs easier: a green check confirms the change still produces a
working ONIE image, so "it builds" becomes part of acceptance testing
rather than something a reviewer has to verify by hand.
The build follows the upstream-recommended containerized flow
(contrib/build-env and machine/kvm_x86_64/INSTALL) rather than any
bespoke scripting:
- .github/onie-build/Dockerfile provides a Debian 11 build
environment. Debian 11 is required because build-config still
pulls in python2-era tooling. The package set is derived from the
legacy toolchain ONIE needs (autoconf/automake, bison/flex, gperf,
stgit for the patch series, libefivar-dev for the UEFI path,
xorriso, etc.); secure-boot/code-signing tooling is intentionally
omitted. The build runs as a "build" user whose UID/GID match the
host runner so artifacts are not left root-owned.
- The workflow disables secure boot (no signing keys to manage) by
swapping in the repo's shipped machine/kvm_x86_64/kernel/
config-insecure and passing SECURE_BOOT_ENABLE=no
SECURE_BOOT_EXT=no SECURE_GRUB=no, then runs the standard
"make MACHINE=kvm_x86_64 all recovery-iso".
Performance and hygiene:
- The build-environment image is built with docker/build-push-action
and GitHub Actions layer caching, so the apt install layer is
reused across runs.
- apt is configured with Acquire::Retries so transient Debian mirror
resets do not fail the build.
- The crosstool-NG cross toolchain (build/x-tools + build/crosstool-ng)
is the long pole of a cold build, so it is built as a discrete
"xtools" make target and cached. The cache key hashes every
toolchain input -- xtools.make, crosstool-ng.make, compiler.make,
conf/crosstool, the crosstool-NG patches, and the Dockerfile (it
defines the environment the toolchain is built in). There are no
loose restore-keys, so any input change forces a clean rebuild
rather than restoring a mismatched toolchain. The cache is saved
only after the toolchain build succeeds and before the full build,
so a broken toolchain is never cached and a later-stage failure
still preserves the toolchain.
- A concurrency group (workflow + ref, cancel-in-progress) ensures a
newer push to the same branch cancels the prior run instead of
stacking concurrent builds.
Signed-off-by: Brad House <bhouse@nexthop.ai>
Owner
Author
|
Closing — opening this against the upstream parent (opencomputeproject/onie) instead of the fork. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a GitHub Actions workflow that builds the generic amd64 ONIE target (
kvm_x86_64, intended to run as a VM under KVM/QEMU) on every push and pull request that touches the build.The goal is to make reviewing other PRs easier: a green check confirms the change still produces a working ONIE image, so "it builds" becomes part of acceptance testing rather than something a reviewer has to verify by hand.
To keep that check fast enough to be practical on every PR, the workflow caches both the Docker build-environment image and the crosstool-NG cross toolchain. A cold build spends ~25 min compiling the toolchain alone; with the cache warm, subsequent PR runs restore it and skip straight to the ONIE build, so the per-PR runtime is dramatically shorter.
What it does
The build follows the upstream-recommended containerized flow (
contrib/build-envandmachine/kvm_x86_64/INSTALL) rather than any bespoke scripting:.github/onie-build/Dockerfile— a Debian 11 build environment. Debian 11 is required becausebuild-configstill pulls in python2-era tooling. The package set covers the legacy toolchain ONIE needs (autoconf/automake, bison/flex, gperf,stgitfor the patch series,libefivar-devfor the UEFI path, xorriso, etc.); secure-boot/code-signing tooling is intentionally omitted. The build runs as abuilduser whose UID/GID match the host runner so artifacts are not left root-owned.machine/kvm_x86_64/kernel/config-insecureand passesSECURE_BOOT_ENABLE=no SECURE_BOOT_EXT=no SECURE_GRUB=no, then runs the standardmake MACHINE=kvm_x86_64 all recovery-iso.Caching — keeping per-PR runtime low
These are the levers that make running on every PR practical:
docker/build-push-action+ GitHub Actions layer caching, so the apt install layer is reused across runs instead of rebuilt every time.build/x-tools+build/crosstool-ng) is the long pole of a cold build (~25 min). It's built as a discretextoolstarget and cached, so warm runs restore it and skip the compile entirely. The key hashes every toolchain input —xtools.make,crosstool-ng.make,compiler.make,conf/crosstool, the crosstool-NG patches, and the Dockerfile (it defines the environment the toolchain is built in). No looserestore-keys, so any input change forces a clean rebuild rather than restoring a mismatched toolchain. The cache is saved only after the toolchain build succeeds and before the full build, so a broken toolchain is never cached and a later-stage failure still preserves the toolchain.Other hygiene
Acquire::Retriesso transient Debian mirror resets don't fail the build.workflow + refwithcancel-in-progress, so a newer push to the same branch cancels the prior run instead of stacking concurrent builds.Testing
Validated end-to-end in this fork: the workflow builds the
kvm_x86_64image (kernel, initrd, onie-updater, recovery ISO) successfully.