Skip to content

fix(containers): pin OpenStack image inputs and build only what changed - #2841

Open
cardoe wants to merge 2 commits into
mainfrom
container-build-hardening
Open

cardoe wants to merge 2 commits into
mainfrom
container-build-hardening

Conversation

@cardoe

@cardoe cardoe commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

What does this change do?

Two commits that make the OpenStack image builds reproducible and cheaper.

Pin what the builds download (fix(containers))

The ironic build broke when the pkgs.k8s.io certificate expired. Several other inputs could also change or vanish without a commit here.

  • airshipit base images are pinned by digest. The release now lives in each FROM line instead of the OPENSTACK_VERSION build arg, so Renovate can update the digests. Renovate groups those updates and won't open release bumps (2026.1 → 2026.2), since the forks have to move with the release.
  • Builds install against the /upper-constraints.txt baked into the base image, the constraints its venv was built with, instead of the live releases.openstack.org file (identical today). The nova base image doesn't include that file, so nova copies it from the matching pinned venv_builder image.
  • uv is pinned to 0.13.9 by digest, replacing :latest.
  • kubectl is copied from registry.k8s.io/kubectl:v1.35.9 instead of adding the pkgs.k8s.io apt repo.
  • The noVNC tarball is checked by sha256 (as keystone does for mod_auth_openidc), and Renovate tracks the noVNC release.

Build only the images that changed, from cache (ci(containers))

  • Builds read a registry cache at ghcr.io/<repo>/<image>:buildcache. Only pushes to main write it, so a PR can't change what other builds start from. This applies to every image built with build-container-reuse.yaml.
  • Pull requests and pushes to main build only the images whose containers/<image>/ directory, Python package, or the shared build workflows changed. Tags, manual runs and the merge queue still build all 11, so openstack-containers-result still gates on every image.
  • The workflow triggers on the four Python packages the images install instead of all of python/.
  • Fork clones are deepened for pbr with commits only (--filter=tree:0). For nova that takes 8 s and 34 MB instead of 55 s and 333 MB.

Testing

  • Built neutron, nova, cinder, keystone and octavia locally for amd64. Their package versions match the published images (e.g. nova 33.0.3.dev43, neutron 28.0.0.0b3.dev395), so the commits-only clone doesn't change pbr's versions. The understack packages import.
  • ironic got through the forks, pbr versions and the noVNC checksum locally. Its noVNC tar step can't run under emulation on arm64 macOS (it fails the same way on main), so this PR's CI run is the first full ironic build. kubectl from the pinned image runs in the ironic base.
  • actionlint and yamllint pass on the container workflows.
  • This PR changes the shared build workflows, so its own run should build all 11 images. The cache only takes effect after the first build on main.

Upgrade impact

  • This change requires operator action to upgrade. If checked, add the
    upgrade-impact label and a release note: run scriv create from the
    repository root and describe the required action in the generated
    changelog.d/ file. See RELEASING.md.

No operator action needed: the images are built the same way from the same inputs.

The OpenStack image builds pulled several things that could change or
disappear without a commit here: floating airshipit base tags, the
latest uv, upper-constraints from releases.openstack.org, an unchecked
noVNC tarball, and kubectl from the pkgs.k8s.io apt repo, whose
expired certificate just broke the ironic build.

- Pin the airshipit base images by digest. The release is now in the
  FROM line instead of the OPENSTACK_VERSION build arg, so Renovate can
  update the digests. Group those updates and leave release changes to
  a human, since the forks move with the release.
- Install against the /upper-constraints.txt baked into the base image,
  the constraints its venv was built with, so the base digest pins it.
  The nova image doesn't keep that file, so nova copies it from the
  matching venv_builder image.
- Pin uv to a release and digest.
- Copy kubectl from the registry.k8s.io/kubectl image instead of
  adding the pkgs.k8s.io apt repo.
- Check the noVNC tarball's sha256, as keystone does for
  mod_auth_openidc, and let Renovate track the noVNC release.
Every OpenStack image build started cold, and any change under python/
rebuilt all eleven images, so an ironic-understack change also rebuilt
keystone, glance, horizon and the rest.

- Reuse the layers of the last main build through a registry cache at
  ghcr.io/<repo>/<image>:buildcache. Only pushes to main write it, so a
  pull request can't change what other builds start from. This applies
  to every image built with build-container-reuse.yaml.
- On pull requests and pushes to main, build only the images whose
  container directory or python package changed (or the shared build
  workflows). Tags, manual runs and the merge queue still build every
  image. A new build input lets a caller skip the build without
  skipping the closed-PR cleanup.
- Trigger on the four python packages the images install instead of
  all of python/.
- Deepen the fork clones for pbr with commits only (--filter=tree:0).
  For nova that is 8s and 34MB instead of 55s and 333MB, and the
  package versions come out the same.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant