staged-images: Add chunkah-staged bootc base image builds#152
staged-images: Add chunkah-staged bootc base image builds#152cgwalters wants to merge 1 commit intobootc-dev:mainfrom
Conversation
Add infrastructure to build rechunked bootc base images using chunkah. These 'staged' images mirror upstream fedora-bootc and centos-bootc, strip /sysroot (ostree data), and rechunk with content-based layers for optimal layer reuse across updates. Source images are pinned by @sha256 digest for reproducibility, with a Renovate custom regex manager to automatically bump digests when upstream tags are updated. Target images: - ghcr.io/bootc-dev/fedora-bootc-staged:43 - ghcr.io/bootc-dev/fedora-bootc-staged:44 - ghcr.io/bootc-dev/centos-bootc-staged:stream10 Closes: bootc-dev#151 Assisted-by: OpenCode (Claude Opus 4)
There was a problem hiding this comment.
Code Review
This pull request introduces a workflow for rechunking bootc base images using the chunkah tool and updates the Renovate configuration to support container image digest pinning in YAML files. Feedback highlights several architectural concerns in the new Containerfile, including the use of non-portable Podman-specific features like oci-archive, the lack of reproducibility due to using the :latest tag for build tools, and a dependency on external, gitignored configuration files. Additionally, a more robust regex for the Renovate custom manager was suggested to better handle varied YAML syntax and optional parameters.
| --label ostree.final-diffid- \ | ||
| > /run/src/out.ociarchive | ||
|
|
||
| FROM oci-archive:out.ociarchive |
There was a problem hiding this comment.
The use of FROM oci-archive:out.ociarchive combined with a writeable bind mount in a previous stage (line 23) is a highly non-standard and non-portable pattern.
Issues with this approach:
- Portability:
FROM oci-archiveis a Podman/Buildah specific extension and will fail on standard Docker/BuildKit builders. - Side-effects: The build process modifies the host's source directory during execution. This can lead to permission issues in CI or leave 'dirty' files if the build fails.
- Build Logic: This relies on
--skip-unused-stages=falsebecause the final stage doesn't have a formal dependency (likeCOPY --from) on thechunkahstage. Most CI environments default to skipping unused stages.
Consider if chunkah can be invoked as part of a CI pipeline script that then passes the resulting archive to a standard build, or if the rechunked content can be extracted and used via COPY --from.
| "customType": "regex", | ||
| "managerFilePatterns": ["**/*.yml", "**/*.yaml"], | ||
| "matchStrings": [ | ||
| "# renovate: datasource=(?<datasource>docker) depName=(?<depName>[^\\s]+)\\n\\s*\\w+:\\s*\\S+:(?<currentValue>[^@\\s]+)@(?<currentDigest>sha256:[a-f0-9]+)" |
There was a problem hiding this comment.
The regex for container image digest pinning could be more robust. Specifically:
- It doesn't allow for an optional
versioning=parameter in the Renovate comment, which is useful for pinning tags (e.g., staying on Fedora 43) while still updating digests. - It doesn't handle optional quotes around the image string in YAML.
- It assumes the YAML key only contains word characters, but keys like
base-image:are common.
Adding these would make the manager more flexible across different YAML structures.
| "# renovate: datasource=(?<datasource>docker) depName=(?<depName>[^\\s]+)\\n\\s*\\w+:\\s*\\S+:(?<currentValue>[^@\\s]+)@(?<currentDigest>sha256:[a-f0-9]+)" | |
| "# renovate: datasource=(?<datasource>docker) depName=(?<depName>[^\\s]+)(?: versioning=(?<versioning>[^\\s]+))?\\n\\s*[\\w-]+:\\s*[\"']?\\S+:(?<currentValue>[^@\\s\"']+)@(?<currentDigest>sha256:[a-f0-9]+)[\"']?" |
| # -f Containerfile.staged . | ||
|
|
||
| ARG SOURCE_IMAGE | ||
| ARG CHUNKAH=quay.io/jlebon/chunkah:latest |
| RUN --mount=type=bind,target=/run/src,rw \ | ||
| --mount=from=source,target=/chunkah,ro \ | ||
| chunkah build \ | ||
| --config /run/src/source-config.json \ |
There was a problem hiding this comment.
The build process depends on an external source-config.json file (generated via podman inspect) which is gitignored and not produced within the Containerfile. This makes the build non-self-contained and requires manual steps or external orchestration to prepare the build context. Consider if this configuration can be derived dynamically during the build or passed as a build argument/secret.
Add infrastructure to build rechunked bootc base images using chunkah. These 'staged' images mirror upstream fedora-bootc and centos-bootc, strip /sysroot (ostree data), and rechunk with content-based layers for optimal layer reuse across updates.
Source images are pinned by @sha256 digest for reproducibility, with a Renovate custom regex manager to automatically bump digests when upstream tags are updated.
Target images:
Closes: #151
Assisted-by: OpenCode (Claude Opus 4)