Skip to content

Fix CopyBaseImages failure for external source registries - #1975

Merged
lbussell merged 2 commits into
dotnet:mainfrom
lbussell:fix-check-base-images
Feb 20, 2026
Merged

lbussell merged 2 commits into
dotnet:mainfrom
lbussell:fix-check-base-images

Conversation

@lbussell

@lbussell lbussell commented Feb 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix the check-base-image-updates-official pipeline failure caused by CopyImageService.ImportImageAsync throwing InvalidOperationException when the source registry is an external registry like docker.io. PR #1945 moved subscription and resource group lookups into CopyImageService, but the new code unconditionally calls GetRegistryResource() for the source registry, which throws when the registry isn't in the publish configuration. External registries like docker.io use username/password credentials for ACR import (via RegistryAddress + Credentials), not Azure resource IDs — they are intentionally not in the RegistryAuthentication list.

Changes

  • Check FindRegistryAuthentication() before calling GetRegistryResource() in CopyImageService.ImportImageAsync, so external source registries correctly get a null ResourceId and use the RegistryAddress code path
  • Add test ImportImageAsync_ExternalSourceRegistry_DoesNotRequireSourceRegistryInPublishConfig to cover the non-dry-run external registry scenario (existing test only covered the dry-run path)

lbussell and others added 2 commits February 20, 2026 09:23
CopyImageService.ImportImageAsync unconditionally called
GetRegistryResource for the source registry, which throws for
external registries like docker.io that aren't in the publish
configuration. External registries use RegistryAddress + Credentials
for ACR import, not ResourceId.

Check FindRegistryAuthentication before calling GetRegistryResource
so that external source registries correctly get a null ResourceId
and use the RegistryAddress path.

Co-authored-by: Copilot <[email protected]>
@lbussell
lbussell marked this pull request as ready for review February 20, 2026 17:40
@lbussell
lbussell requested a review from a team as a code owner February 20, 2026 17:40
@lbussell
lbussell merged commit aaa7ec9 into dotnet:main Feb 20, 2026
12 checks passed
@lbussell
lbussell deleted the fix-check-base-images branch February 20, 2026 22:54
lbussell added a commit that referenced this pull request Mar 4, 2026
`git bisect` found that #1975 caused ImageBuilder's test to slow down
dramatically, increasing from ~3 seconds to 100+ seconds.

The test
`ImportImageAsync_ExternalSourceRegistry_DoesNotRequireSourceRegistryInPublishConfig`
calls `CopyImageService.ImportImageAsync` with `isDryRun: false`, which
hits real ARM SDK methods through a mocked `TokenCredential`. Each call
fails and `RetryHelper` retries 5 times with backoff as well, causing
that single test to take over one minute.

This PR adds an abstraction for the ARM client which `CopyImageService`
resolves via DI so that the test can mock it. All 424 tests now pass in
~5 seconds.
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.

2 participants