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 --layers with a registry cache, so the package install layer in the root stage was reused until the base image changed. The main image from 2026-11-19 still had git 2.54.0-r0 because the layer dated from the alpine:3.24.4 bump on 2026-11-06.
    • Packages that come with the base image were never upgraded. apk add and apt-get install leave installed packages alone. zlib comes with alpine:3.24.4 (released 2026-11-05) because apk-tools needs it, so zlib 1.4-r0 (2026-11-06) could never reach the image.

    The root stage now upgrades installed packages before installing ours. It also declares ARG 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 each RUN, 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.

  • Scan tag pipelines. The components/container-scanning@5.2.0 job only has rules for merge request and branch pipelines, so the 5.1.0 release pipeline had no test:container-scanning job. The rules are overridden to also run on tags. The scanned $CI_COMMIT_SHA image is the one the deploy jobs crane copy to the release tags. The component sets allow_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:build jobs rerun the upgrade and install step instead of logging Using cache for it.
  • The SBOM from test:container-scanning: [alpine] lists git 2.54.1-r0 and zlib 1.4-r0.

Related to #542

Merge request reports

Loading
Loading