Repository navigation
Fix CopyBaseImages failure for external source registries - #1975
Merged
Merged
Conversation
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
marked this pull request as ready for review
February 20, 2026 17:40
mthalman
approved these changes
Feb 20, 2026
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.
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
Fix the
check-base-image-updates-officialpipeline failure caused byCopyImageService.ImportImageAsyncthrowingInvalidOperationExceptionwhen the source registry is an external registry likedocker.io. PR #1945 moved subscription and resource group lookups intoCopyImageService, but the new code unconditionally callsGetRegistryResource()for the source registry, which throws when the registry isn't in the publish configuration. External registries likedocker.iouse username/password credentials for ACR import (viaRegistryAddress+Credentials), not Azure resource IDs — they are intentionally not in theRegistryAuthenticationlist.Changes
FindRegistryAuthentication()before callingGetRegistryResource()inCopyImageService.ImportImageAsync, so external source registries correctly get a nullResourceIdand use theRegistryAddresscode pathImportImageAsync_ExternalSourceRegistry_DoesNotRequireSourceRegistryInPublishConfigto cover the non-dry-run external registry scenario (existing test only covered the dry-run path)