Dockerfile: parameterize photon-snapshot repo for portability#43
Closed
dcasota wants to merge 1 commit into
Closed
Dockerfile: parameterize photon-snapshot repo for portability#43dcasota wants to merge 1 commit into
dcasota wants to merge 1 commit into
Conversation
The base stage runs `tdnf-config edit photon-snapshot enabled=1`, which assumes /etc/yum.repos.d/photon-snapshot.repo is already present in the photon:5.0 image. That file is shipped by photon-repos on the 5.0 branch of vmware/photon, but NOT by the photon-repos used to build Docker Hub's library/photon:5.0. As a result every push to master since e0640fa has failed the public photon-os-installer CI with `repo 'photon-snapshot' not found`. Generate the file from a SNAPSHOT_BASEURL build-arg when missing (default = canonical Broadcom Photon 5.0 main repo, which carries repodata and is what photon-repos@5.0 already points at). Existing files are not overwritten, so VCF/Broadcom-proxied images that already ship photon-snapshot.repo with the snapshot=/$subrelease/$updatenumber pinning continue to work unchanged. Side effect: the Dockerfile now works on stock library/photon:5.0, unblocks the public photon-os-installer CI, and lets airgap or alternate-mirror builds swap a single --build-arg. Tested: - stock library/photon:5.0, default SNAPSHOT_BASEURL: full multi-stage build (`docker build .` from docker/) reaches step 27/31 and installs photon-os-installer-2.4-1.ph5 and dependencies from photon-snapshot with gpgcheck=1. Step 28 fails on the pre-existing legacy-builder COPY trailing-slash issue covered by PR vmware#38, not related to this change. - airgap simulation, SNAPSHOT_BASEURL=http://localhost:8765 with repodata generated by `vmware/tdnf/scripts/make-snapshot-repo` and RPMs mirrored locally: same multi-stage path passes with zero outbound traffic to packages.broadcom.com. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Thank you. But we can just go back to using |
Author
|
Hi Oliver, I hope you are doing well. Sorry for the long PR text. Claude Code works well, but too much detail takes time to read. The TDNF improvements for air-gapped environments are excellent and easily one of the standout features. Thanks for #44. It's helping unblock the other PRs. |
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.
Summary
docker/Dockerfile'sbasestage callstdnf-config edit photon-snapshot enabled=1, which assumes/etc/yum.repos.d/photon-snapshot.repois already present in the base image. That assumption holds inside Broadcom CI (wherelibrary/photon:5.0is proxied through an internal mirror that ships the file), but not on Docker Hub's stocklibrary/photon:5.0— and so every push tomastersincee0640fa("Dockerfile: use snapshots instead of photon-updates", 2026-04-15) has failed the publicphoton-os-installer CIworkflow with:This change makes the
basestage generate/etc/yum.repos.d/photon-snapshot.repofrom aSNAPSHOT_BASEURLbuild-arg only when the file is missing. Images that already ship the file (the VCF/Broadcom-proxiedphoton:5.0, including itssnapshot=pinning with$subrelease/$updatenumbersubstitutions) are not touched. The default URL is the canonical Broadcom Photon 5.0 main repo (https://packages.broadcom.com/photon/5.0/photon_5.0_x86_64), which is exactly whatphoton-repos@5.0points at. GPG verification stays on (gpgcheck=1), using theVMWARE-RPM-GPG-KEY{,-4096}keys that the existingphoton-repospackage already installs into/etc/pki/rpm-gpg/.A second optional arg
SNAPSHOT_LISTURLlets callers pin to a.listsnapshot manifest (TDNF on the 5.0 branch honorssnapshot=); empty leaves the repo unpinned.This unblocks the public CI on stock
library/photon:5.0and makes airgap/alternate-mirror builds a single--build-argswap.Test results
Stock
library/photon:5.0, defaultSNAPSHOT_BASEURL: full multi-stage build (docker build .fromdocker/) reaches step 27/31 and installsphoton-os-installer-2.4-1.ph5plus all dependencies from the newphoton-snapshotrepo withgpgcheck=1. Step 28 fails on the pre-existing legacy-builderCOPY ... /usr/bintrailing-slash issue (covered by PR #38) — not related to this change. With BuildKit (the official CI builder) the full pipeline completes.Airgap simulation,
SNAPSHOT_BASEURL=http://localhost:8765: repodata generated byvmware/tdnf/scripts/make-snapshot-repoagainst a small.list, RPMs mirrored to<root>/x86_64/, served viapython -m http.server. Build with--network=host --build-arg SNAPSHOT_BASEURL=http://localhost:8765succeeds, GPG-checked install passes, access log shows zero outbound traffic topackages.broadcom.com. (Caveat: stock TDNF 3.5.16 inphoton:5.0does not honor thexml:baseredirect thatmake-snapshot-repowrites; package URLs are resolved againstbaseurl, so airgap setups must mirror the RPMs at the same prefix as the metadata. Worth filing as avmware/tdnfissue separately.)Why this hasn't been fixed already
1. The
photon-snapshot.repofile does exist upstream — but on the wrong branch.On
vmware/photon's5.0branch,SPECS/photon-repos/photon-snapshot.repoexists (Bo Gan, commitd9dcf88, 2026-03-05; refined by Shreenidhi Shedif934696, 2026-03-30):Note the non-standard
snapshot=key — TDNF on the 5.0 branch was extended to honor it natively for snapshot pinning. Onvmware/photon'smasterbranch (which feedslibrary/photon:5.0via a different toolchain), this file is not present.2. Docker Hub
library/photon:5.0is built from a rootfs that uses the master-branch photon-repos.The image is published from
vmware/photon-docker-image, branchx86_64/5.0-20260411, whose Dockerfile is justFROM scratch / ADD photon-rootfs-5.0-b95ccb18f.x86_64.tar.gz /. That tarball ships aphoton-repospackage matchingvmware/photon's master layout (7 repo files, no snapshot). So in any environment that pullslibrary/photon:5.0from Docker Hub directly, the snapshot file is missing.3. Internally, Broadcom doesn't hit this because their CI proxies
library/photon:5.0throughharbor-repo.vmware.com/dockerhub-proxy-cache/— and that mirror serves a different, internally-built photon:5.0 whosephoton-reposdoes shipphoton-snapshot.repo. Sotdnf-config edit photon-snapshot enabled=1succeeds inside VCF infrastructure.4. The breaking commit was authored by the maintainer himself and never noticed.
e0640fa(Oliver Kurth, 2026-04-15, "Dockerfile: use snapshots instead of photon-updates") refactored to abasestage and switched the policy. It was tested against the Broadcom-proxied base image, where it works. Since then every master push has failed the publicphoton-os-installer CI:Last green master CI run was
24107696919(PR #41 "fix-docker-rpm-unshare", 2026-04-07) — the run beforee0640fa. There is no upstream issue or PR tracking the breakage. The badge is just stuck red because the team's source-of-truth CI is the VCF self-hosted workflow.5. Upstream already provides the right tooling for Option 2 — they just didn't wire it into the Dockerfile.
vmware/tdnfshipsscripts/make-snapshot-repo, an official Python tool that does exactly what we did in Test 3: take a.listand produce arepodata/tree. The whole airgap pattern (parameterizable baseurl + locally-generated repodata + GPG via the pre-shipped photon-repos keys) is already the supported model upstream — it was just never adopted inphoton-os-installer's Dockerfile because the maintainer's own dev/CI environment makes the gap invisible.Test plan
photon-os-installer CI(the public workflow onubuntu-22.04) goes green on this PR for the first time since 2026-04-07.photon-os-installer CI on VCF(the self-hosted workflow) stays green — the existingphoton-snapshot.repoin the Broadcom-proxied base image is still respected because theif [ ! -f … ]guard skips the generation block when the file is already present.SNAPSHOT_BASEURL(and optionallySNAPSHOT_LISTURL) at build time without further Dockerfile changes.🤖 Generated with Claude Code