Refresh image packages daily and scan tag pipelines
What does this MR do?
Makes the images pick up current Alpine and Debian package fixes, and scans the images that tag pipelines publish.
-
Refresh the package layer daily. Two things kept packages stale:
- The build uses
--layerswith a registry cache, so the package install layer in therootstage was reused until the base image changed. Themainimage from 2026-11-19 still hadgit 2.54.0-r0because the layer dated from thealpine:3.24.4bump on 2026-11-06. - Packages that come with the base image were never upgraded.
apk addandapt-get installleave installed packages alone.zlibcomes withalpine:3.24.4(released 2026-11-05) becauseapk-toolsneeds it, sozlib 1.4-r0(2026-11-06) could never reach the image.
The
rootstage now upgrades installed packages before installing ours. It also declaresARG PACKAGE_INDEX_DATE, and the build passes the pipeline's creation date. buildah writes a stage's declared build args into the history entry of eachRUN, and that entry is the cache key. So the first pipeline of a day reruns the upgrade and install, and later pipelines that day reuse that layer. The refresh happens only when a pipeline runs. Tag pipelines always get that day's packages. - The build uses
-
Scan tag pipelines. The
components/container-scanning@5.2.0job only has rules for merge request and branch pipelines, so the 5.1.0 release pipeline had notest:container-scanningjob. The rules are overridden to also run on tags. The scanned$CI_COMMIT_SHAimage is the one the deploy jobscrane copyto the release tags. The component setsallow_failure: true, so this gives visibility on the release, not a gate.
The published 5.1.0 images were built before the fixed packages existed, on alpine:3.24.3. They only get the fixes through a new release made after this MR is merged.
How to verify
In this MR's pipeline:
- The
gitlab-opentofu-image:buildjobs rerun the upgrade and install step instead of loggingUsing cachefor it. - The SBOM from
test:container-scanning: [alpine]listsgit 2.54.1-r0andzlib 1.4-r0.
Related to #542