Skip to content

Check base images using mirror registry instead of public DockerHub (+ pipeline changes)#2123

Draft
lbussell wants to merge 8 commits into
dotnet:mainfrom
lbussell:fix-check-base-images-pipelines
Draft

Check base images using mirror registry instead of public DockerHub (+ pipeline changes)#2123
lbussell wants to merge 8 commits into
dotnet:mainfrom
lbussell:fix-check-base-images-pipelines

Conversation

@lbussell
Copy link
Copy Markdown
Member

This PR is based on #2119 and also includes the necessary pipeline changes that should be applied after the ImageBuilder reference is updated.

lbussell and others added 8 commits May 26, 2026 10:20
The previous --base-override-regex/sub approach rewrote external FROM
tags to point at the staging mirror, but the rewritten repo prefix
also leaked into the digest comparison string. image-info.json stores
the digest against the canonical (public) repo, so every rewritten
image compared unequal and was reported stale on every run.

Switch getStaleImages to the same mechanism the build/matrix flow
already uses:
- Add --registry-override and --source-repo-prefix options (mirroring
  what ManifestOptions exposes and what copyBaseImages consumes).
- Construct ImageNameResolverForMatrix per subscription manifest.
  GetFromImagePullTag returns the staging mirror location for fetching
  the digest; GetFromImagePublicTag returns the canonical reference
  used to build the digest comparison string.

The pipeline yml now passes --registry-override / --source-repo-prefix
in place of the regex pair, matching how the copyBaseImages step in
the same job is invoked. --base-override-regex/sub remains supported
for genuine one-off overrides.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Two different FROM spellings can normalize to the same pull tag
(e.g. 'almalinux:8' and 'library/almalinux:8' both pull from
'<staging>/mirror/library/almalinux:8') but produce different public
tags. The previous code cached the full '<repo>@<sha>' comparison
string by pull tag, which meant the second lookup could reuse the
first FROM's public repo prefix and falsely mark the image as stale.

Cache only the raw SHA so the comparison string is always built from
the current platform's own public tag.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
copyBaseImages already imports every base image into the internal
staging ACR ('mirror/' prefix) immediately before getStaleImages runs,
but getStaleImages was still resolving FROM tags against docker.io.
That path is unreachable from the internal 1ES pool, so the command
hangs for 30s on each Docker Hub base image and the job fails.

Rewrite any non-MCR / non-*.azurecr.io FROM reference to the staging
mirror via --base-override-regex/--base-override-sub. The job already
authenticates to InternalMirrorRegistry via reference-service-connections,
so no credential changes are needed. Also drops the buildtools-only
override (which never matched the actual library/<distro> FROM lines).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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