ci: build and publish minimal OCI module image - #39
Merged
Conversation
Add a pipeline that publishes a minimal multi-arch (amd64 + arm64) OCI image containing only libvalkeyaudit.so, for use as a Kubernetes ImageVolume (or copied out via an init container). The final image is FROM scratch: no shell, no runtime, just the .so + LICENSE at a stable /libvalkeyaudit.so path. - docker/Dockerfile.module: fetches valkeymodule.h for a pinned VALKEY_VERSION, builds the module with a portable per-arch -march baseline (amd64 -> x86-64-v2, arm64 -> armv8-a), strips, and copies in LICENSE. Builds only the valkeyaudit target with tests disabled. - .github/workflows/publish-image.yml: builds each arch natively (no QEMU) and pushes by digest, then merges into a single manifest list. Per-arch builds set provenance/sbom=false so the published index contains exactly two platform entries and no unknown/unknown attestation manifest (some kubelet/containerd ImageVolume paths choke on that). Supply-chain metadata is attached to the final index via GitHub build provenance attestation + keyless cosign signing. The package is published as <owner>/valkey-audit-module; the image name is lowercased since GHCR rejects uppercase repository paths. - CMakeLists.txt: expose Release flags via the AUDIT_C_FLAGS_RELEASE cache variable so a distributable build can override the default -march=native (which tunes to the build host and would SIGILL elsewhere) without being silently shadowed by the in-file set(). Add the VALKEY_AUDIT_TESTS option to skip the configure-time googletest download when building only the module.
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 CI pipeline that publishes a minimal multi-arch (amd64 + arm64) OCI image containing only
libvalkeyaudit.so, intended to be consumed as a Kubernetes ImageVolume (or copied out with an init container). The final image isFROM scratch— no shell, no runtime — with the module at a stable/libvalkeyaudit.sopath plusLICENSE.This lets the audit module be shipped and version-pinned independently of the Valkey runtime image, and mounted into a stock
valkey/valkeycontainer.What's included
docker/Dockerfile.module— fetchesvalkeymodule.hfor a pinnedVALKEY_VERSION, builds the module with a portable per-arch-marchbaseline (amd64 → x86-64-v2,arm64 → armv8-a), strips, and copies inLICENSE. Builds only thevalkeyaudittarget with tests disabled..github/workflows/publish-image.yml— builds each arch natively (no QEMU) and pushes by digest, then merges into a single manifest list. Per-arch builds setprovenance/sbom=falseso the published index contains exactly two platform entries and nounknown/unknownattestation manifest (some kubelet/containerd ImageVolume paths choke on that). Supply-chain metadata is instead attached to the final index via GitHub build provenance attestation + keyless cosign signing. Triggers onv*.*.*tags andworkflow_dispatch.CMakeLists.txt— two small, backwards-compatible changes that the Dockerfile relies on:AUDIT_C_FLAGS_RELEASEcache variable. The currentset(CMAKE_C_FLAGS_RELEASE ...)is a plain (non-cache) set that silently shadows any-DCMAKE_C_FLAGS_RELEASEpassed on the command line — so the distributable build's portable-marchoverride was being discarded and-march=nativeused instead (would SIGILL on older CPUs). Local dev still defaults to-march=native.VALKEY_AUDIT_TESTSoption (defaultON) so the artifact build can skip the configure-time googletestFetchContentdownload.Published image name / tags
Package is published as
ghcr.io/<owner>/valkey-audit-module(lowercased — GHCR rejects uppercase repo paths). Example tags on av1.0.0release:1.0.0,1.0,1,latest,valkey9.1.0— all pointing at the same multi-arch index.Test plan
Verified end-to-end on a fork:
-march=x86-64-v2, googletest skipped,lddshows libc-only deps.actionlintclean (only intentionalSC2086word-split onimagetools create).workflow_dispatchrun green: native amd64 + arm64 builds → merged manifest list with exactlylinux/amd64+linux/arm64(nounknown/unknown) → cosign signature pushed + provenance attested.-march=nativeis preserved for normal local/CI builds.Notes