Update the GitLab CI/CD configuration to utilize Podman for multi-architecture
image builds, replacing the previous Buildah-based approach. The new
build-multiarch.sh script is refined to support both standard and testing
build flows, with automated cleanup for testing images.
The previous setup used buildah directly in the .gitlab-ci.yml script.
This change centralizes the build logic into a dedicated script, enhancing
maintainability and reusability. Podman is a suitable alternative as it
supports the same command-line options as Docker, offering a simpler CI
configuration without the overhead of a Docker daemon pythonspeed.com.
Key changes include:
- Migrate from
buildahtoquay.io/podman/stableas the base image for the build job in.gitlab-ci.yml. - Introduce
dnf install -y skopeoto enable deleting images from the registry using Skopeo during testing, ensuring better cleanup practices docs.gitlab.com. - Implement
podman loginto explicitly authenticate with the GitLab Container Registry, aligning with best practices for building and pushing images docs.gitlab.com. - Refine the
build-multiarch.shscript to:- Consolidate logic for extracting the project image name, handling
GitLab CI/CD variables (
CI_REGISTRY_IMAGE,CI_COMMIT_SHORT_SHA), or local Git configuration. - Add a
--testingflag to append a-testingsuffix to image tags and ensure automatic cleanup of remote images usingskopeoafter the push, which requires theGITLAB_TOKEN_REGISTRYenvironment variable. This helps to manage test artifacts in the registry. - Simplify argument parsing and improve error handling for better user experience.
- Remove redundant local cleanup logic now that the script can clean up remote tags.
- Consolidate logic for extracting the project image name, handling
GitLab CI/CD variables (
This refactoring streamlines the image building workflow within GitLab CI/CD,
making it more robust and flexible for both production and development testing
scenarios. Podman provides a stable and secure environment for container
operations, including rootless builds, which enhances the security posture
of the CI pipeline docs.gitlab.com. The Docker executor now uses
Podman as its container runtime, supporting services when the
FF_NETWORK_PER_BUILD feature flag is enabled docs.gitlab.com.