Repository navigation
[v3-4-test] Build CI and release images on pinned OS-dependencies images (#76225) - #76642
Merged
Merged
Conversation
potiuk
requested review from
amoghrajesh,
ashb,
bugraoz93,
choo121600,
ephraimbuddy,
gopidesupavan,
jason810496,
jedcunningham,
jscheffl and
vatsrahul1001
as code owners
November 7, 2026 00:03
potiuk
enabled auto-merge (squash)
November 7, 2026 00:03
…ges (#76225) * Build CI and release images on pinned OS-dependencies images Pinning the hardened base image to a digest does not pin the dhi.io apt repository the OS dependencies are installed from. It moves on - and drops the package versions it replaced - whenever Docker rebuilds its images, so the same commit could build today and fail tomorrow, and a dhi.io change broke main instead of an upgrade PR. Installing the OS dependencies once, in images built on the mirrored base images and pinned by the same upgrade check, makes day-to-day builds independent of the live repository: a dhi.io change can only break the scheduled image build or the upgrade PR. Standalone builds of the Dockerfile still install from the repositories. * Build the OS-dependencies images daily instead of on every mirror run Docker rebuilds the hardened base images several times a day, and rebuilding every OS-dependencies image for each new digest would run a full set of image builds on every mirror run. Building them daily is enough to keep the pinned images close to the apt repository, and the upgrade check no longer triggers builds of its own. As the base image pins now move more often than the OS-dependencies images, the upgrade check pins the latest published image of each Python patch release, whatever base image digest it was built on - the image carries its own Python. * Fix the legacy PROD image and isolate the OS-dependencies builds The legacy flavor's runtime OS installation links the compiled Python, so the Python copied from the build image has to be in place before it runs - copying it afterwards broke the legacy image. A cache-disabled build is asked to install everything from scratch, and the CI image's DEPENDENCIES_EPOCH_NUMBER forces reinstallation, so neither may be satisfied by a pinned OS-dependencies image. The daily OS-dependencies builds no longer hold up mirror-only runs, which the upgrade check waits for with a short timeout, and they build on the digests their own run mirrored. Dry runs now print the build plan, and the release image log names the image type again. * Publish OS-dependencies images ahead of patch releases and pin them on main only The upgrade check moves the base image pin to a newer Python patch release as soon as the mirror has it, and without OS-dependencies images for that patch release the upgrade PR and main installed from the live apt repository again - the failure the pinned images are there to avoid. Building them for every patch release the mirror copied publishes them before the pin moves. The images are built from main's install script and Dockerfiles, so a release branch pinning them would never match its own installation and would ship both dependency sets; only main pins them until there are images per branch. A dry run of the publication now prints its plan instead of failing on the registry lookups it skips. * Build each OS-dependencies stage fresh once and record the base image it used Forcing the whole build fresh made the runtime OS-dependencies image repeat the dev installation it copies the Python distribution from, although the dev image had just been built in the same job. Forcing only the target stage fresh reuses it. An image built on a pinned OS-dependencies image recorded the BASE_IMAGE it was given, while its layers come from the OS-dependencies image, which may be built on an older digest - the images now record which image their OS dependencies came from and the base image those were installed on. * Keep the pinned OS-dependencies images on cache-disabled build retries The CI image builds retry with the image cache disabled after any failed first attempt, so tying the pinned OS-dependencies images to a disabled cache sent every retry to the live apt repository - the failure the pinned images avoid. Using them is now its own setting, which only the 'disable image cache' label turns off, and it can be set for a single build. * Install the database clients with the pinned OS dependencies The MySQL, MSSQL and PostgreSQL clients were installed after the pinned OS-dependencies layer, so every CI and PROD build still ran apt against the live repositories for them - without the alignment with the dhi.io repository, which the skipped OS installation no longer ran first. Installing them with the OS dependencies puts them in the pinned images, and the marker now covers their scripts and selection, so a different choice reinstalls them. The runtime OS-dependencies build also starts from the dev image built before it rather than repeating the dev installation when that build was skipped or ran in an earlier job. * Hash the database client scripts and keys into the OS-dependencies image tag install_os_dependencies.sh now runs the database client scripts, so a change to only one of them, or to a repository key, must produce a new OS-dependencies image. Otherwise the daily build sees the image as already built while every CI and PROD build's marker misses, and each reinstalls from the live repositories until the base image happens to change. * Document the pinned OS-dependencies images and record the decision in an ADR The CI images doc did not explain where the OS dependencies of CI and release images come from, and the reasons for pinning them - and the alternatives rejected - were only in PR discussions. * Build the OS dependencies from the base image when a PR changes their scripts Reinstalling on top of a pinned OS-dependencies image only exercises additions: a package or database client the change drops stays installed from the pinned layer, so CI could pass while something still depends on it. * Document that a PR changing the OS-dependency scripts builds from the base image (cherry picked from commit aa0d650) Conflicts resolved by hand: the v3-4-test BASE_IMAGE digest is kept, and the breeze help hashes were regenerated from this branch. dev/breeze/tests/test_os_deps_images.py combines the file from #76225 with the test #76659 added, in its main form: with the marker hash from #76225 the script needs cat, cut, dirname and sha256sum before it reaches the Python check. Generated-by: Claude Opus 5
potiuk
force-pushed
the
backport-aa0d650-v3-4-test
branch
from
November 9, 2026 01:56
13fe6d4 to
b52fd69
Compare
1 task done
vatsrahul1001
pushed a commit
that referenced
this pull request
Nov 9, 2026
…ges (#76225) (#76642) * Build CI and release images on pinned OS-dependencies images Pinning the hardened base image to a digest does not pin the dhi.io apt repository the OS dependencies are installed from. It moves on - and drops the package versions it replaced - whenever Docker rebuilds its images, so the same commit could build today and fail tomorrow, and a dhi.io change broke main instead of an upgrade PR. Installing the OS dependencies once, in images built on the mirrored base images and pinned by the same upgrade check, makes day-to-day builds independent of the live repository: a dhi.io change can only break the scheduled image build or the upgrade PR. Standalone builds of the Dockerfile still install from the repositories. * Build the OS-dependencies images daily instead of on every mirror run Docker rebuilds the hardened base images several times a day, and rebuilding every OS-dependencies image for each new digest would run a full set of image builds on every mirror run. Building them daily is enough to keep the pinned images close to the apt repository, and the upgrade check no longer triggers builds of its own. As the base image pins now move more often than the OS-dependencies images, the upgrade check pins the latest published image of each Python patch release, whatever base image digest it was built on - the image carries its own Python. * Fix the legacy PROD image and isolate the OS-dependencies builds The legacy flavor's runtime OS installation links the compiled Python, so the Python copied from the build image has to be in place before it runs - copying it afterwards broke the legacy image. A cache-disabled build is asked to install everything from scratch, and the CI image's DEPENDENCIES_EPOCH_NUMBER forces reinstallation, so neither may be satisfied by a pinned OS-dependencies image. The daily OS-dependencies builds no longer hold up mirror-only runs, which the upgrade check waits for with a short timeout, and they build on the digests their own run mirrored. Dry runs now print the build plan, and the release image log names the image type again. * Publish OS-dependencies images ahead of patch releases and pin them on main only The upgrade check moves the base image pin to a newer Python patch release as soon as the mirror has it, and without OS-dependencies images for that patch release the upgrade PR and main installed from the live apt repository again - the failure the pinned images are there to avoid. Building them for every patch release the mirror copied publishes them before the pin moves. The images are built from main's install script and Dockerfiles, so a release branch pinning them would never match its own installation and would ship both dependency sets; only main pins them until there are images per branch. A dry run of the publication now prints its plan instead of failing on the registry lookups it skips. * Build each OS-dependencies stage fresh once and record the base image it used Forcing the whole build fresh made the runtime OS-dependencies image repeat the dev installation it copies the Python distribution from, although the dev image had just been built in the same job. Forcing only the target stage fresh reuses it. An image built on a pinned OS-dependencies image recorded the BASE_IMAGE it was given, while its layers come from the OS-dependencies image, which may be built on an older digest - the images now record which image their OS dependencies came from and the base image those were installed on. * Keep the pinned OS-dependencies images on cache-disabled build retries The CI image builds retry with the image cache disabled after any failed first attempt, so tying the pinned OS-dependencies images to a disabled cache sent every retry to the live apt repository - the failure the pinned images avoid. Using them is now its own setting, which only the 'disable image cache' label turns off, and it can be set for a single build. * Install the database clients with the pinned OS dependencies The MySQL, MSSQL and PostgreSQL clients were installed after the pinned OS-dependencies layer, so every CI and PROD build still ran apt against the live repositories for them - without the alignment with the dhi.io repository, which the skipped OS installation no longer ran first. Installing them with the OS dependencies puts them in the pinned images, and the marker now covers their scripts and selection, so a different choice reinstalls them. The runtime OS-dependencies build also starts from the dev image built before it rather than repeating the dev installation when that build was skipped or ran in an earlier job. * Hash the database client scripts and keys into the OS-dependencies image tag install_os_dependencies.sh now runs the database client scripts, so a change to only one of them, or to a repository key, must produce a new OS-dependencies image. Otherwise the daily build sees the image as already built while every CI and PROD build's marker misses, and each reinstalls from the live repositories until the base image happens to change. * Document the pinned OS-dependencies images and record the decision in an ADR The CI images doc did not explain where the OS dependencies of CI and release images come from, and the reasons for pinning them - and the alternatives rejected - were only in PR discussions. * Build the OS dependencies from the base image when a PR changes their scripts Reinstalling on top of a pinned OS-dependencies image only exercises additions: a package or database client the change drops stays installed from the pinned layer, so CI could pass while something still depends on it. * Document that a PR changing the OS-dependency scripts builds from the base image (cherry picked from commit aa0d650) Conflicts resolved by hand: the v3-4-test BASE_IMAGE digest is kept, and the breeze help hashes were regenerated from this branch. Generated-by: Claude Opus 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Manual backport of #76225 to
v3-4-test, as the automatic backport failed.Conflicts resolved by hand:
Dockerfile: kept thev3-4-testBASE_IMAGEdigest and added the newDEV_OS_DEPS_IMAGEandRUNTIME_OS_DEPS_IMAGEargs.dev/breeze/doc/images/output_{ci,prod}-image_build.txt: regenerated the hashes from this branch.hardened_os_deps_image_digests.jsonis empty here, as in the original PR, so builds fall back toBASE_IMAGEuntil OS-dependencies images are pinned.Checks run locally:
dev/breeze/testsfor OS-dependencies images, CI upgrade, workflow utils, base image mirroring and selective checks (534 passed),regenerate-command-images --check-onlyandcheck-all-params-in-groups. The prek hooks that need Docker (hadolint, shellcheck, lychee) could not run locally, so they run here for the first time.breeze verifywas not run.The branch is in
apache/airflowrather than a fork because the change touches workflows and needs the full CI.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Opus 5 following the guidelines
🤖 Generated with Claude Code