Repository navigation
Separate Registry Endpoints from Authentication in PublishConfig - #1945
Merged
Merged
Conversation
…ame service connection
CopyAcrImagesCommand was passing srcResourceId to the wrapper method, but CopyImagesCommand.ImportImageAsync ignored it and passed null for srcRegistryName to the service. This caused CopyImageService to set ResourceId to null, resulting in Azure API 400 errors. Fix by passing srcRegistryName instead, allowing CopyImageService to look up the ResourceId from the registry name as designed.
Azure ACR import only accepts one source identifier. Set ResourceId for ACR-to-ACR imports, or RegistryAddress for external registries, not both.
lbussell
force-pushed
the
publishconfig
branch
from
January 28, 2026 19:21
3613bfa to
2ca4696
Compare
These CLI options (--acr-subscription, --acr-resource-group) were defined but never used by BuildCommand. Registry subscription/resource group info is now provided per-registry via PublishConfiguration.
lbussell
force-pushed
the
publishconfig
branch
from
February 2, 2026 17:58
fe8ffe3 to
bee0284
Compare
lbussell
marked this pull request as ready for review
February 2, 2026 17:59
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors PublishConfiguration to separate registry endpoint addresses from authentication details, making it easier to share credentials across registries and support non-ACR registries.
Changes:
- Introduced
RegistryEndpointandRegistryAuthenticationtypes to separate concerns - Changed
PublishConfigurationschema to useRegistryEndpointfor registry references and a list ofRegistryAuthenticationfor credential lookup - Removed subscription and resource group CLI arguments from commands, moving this data to the publish configuration
- Updated all consumers to use new lookup methods (
FindRegistryAuthentication,GetRegistryResource)
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| RegistryEndpoint.cs | New record type holding registry server address only |
| RegistryAuthentication.cs | New record type for authentication and Azure metadata |
| RegistryExtensions.cs | Extension methods for registry operations |
| PublishConfiguration.cs | Updated to use new types and lookup structure |
| ConfigurationExtensions.cs | Added lookup methods for authentication and resource IDs |
| RegistryResolver.cs | Updated to use RegistryAuthentication instead of RegistryConfiguration |
| RegistryManifestClientFactory.cs | Updated to use new authentication lookup |
| RegistryCredentialsProvider.cs | Updated method signature to accept RegistryAuthentication |
| CopyImageService.cs | Moved resource ID creation from parameters to internal lookup |
| CopyImagesOptions.cs | Removed subscription and resource group properties |
| CopyImagesCommand.cs | Simplified with primary constructor, removed subscription/resource group parameters |
| BuildOptions.cs | Removed subscription and resource group CLI options |
| BuildCommand.cs | Updated to use simplified ImportImageAsync signature |
| AcrContentClientFactory.cs | Updated to use new authentication lookup |
| AcrClientFactory.cs | Updated to use new authentication lookup |
| PublishConfigurationBindingTests.cs | New test file for configuration binding validation |
| Various test files | Updated to remove subscription/resource group setup and verification |
mthalman
approved these changes
Feb 2, 2026
lbussell
added a commit
that referenced
this pull request
Feb 20, 2026
Fix the `check-base-image-updates-official` pipeline 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. - 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) --------- Co-authored-by: Copilot <[email protected]>
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.
Fixes #1914.
Problem
The current
PublishConfigurationtightly couples registry endpoints with authentication details. EachRegistryConfigurationembeds its ownServiceConnection,ResourceGroup, andSubscription, making it difficult to:Changes
Refactored
PublishConfigurationto separate concerns:New types:
RegistryEndpoint- Holds only the registry server addressRegistryAuthentication- HoldsServer+ServiceConnection+ ACR metadata (ResourceGroup,Subscription)New schema:
{ "PublishConfiguration": { "BuildRegistry": { "Server": "build.azurecr.io" }, "PublishRegistry": { "Server": "publish.azurecr.io" }, "InternalMirrorRegistry": { "Server": "internal-mirror.azurecr.io" }, "PublicMirrorRegistry": { "Server": "public-mirror.azurecr.io" }, "RegistryAuthentication": [ { "Server": "build.azurecr.io", "ServiceConnection": { "Name": "...", "Id": "...", "TenantId": "...", "ClientId": "..." }, "ResourceGroup": "rg-build", "Subscription": "sub-build" }, { "Server": "publish.azurecr.io", "ServiceConnection": { "Name": "...", "Id": "...", "TenantId": "...", "ClientId": "..." }, "ResourceGroup": "rg-publish", "Subscription": "sub-publish" } ] } }Multiple registries can now share authentication by referencing the same server in
RegistryAuthentication. The authentication is looked up by server address usingFindRegistryAuthentication().Registry Endpoints Added:
BuildRegistry- Images are built and pushed here before testing and publishingPublishRegistry- Images are copied from BuildRegistry to here during publishingInternalMirrorRegistry- External image dependencies are mirrored herePublicMirrorRegistry- External images are mirrored here with anonymous pull access for public PR validationFiles changed:
RegistryEndpoint.cs- Registry endpoint record with onlyServerpropertyRegistryAuthentication.cs- Authentication record withServer,ServiceConnection,ResourceGroup,SubscriptionRegistryExtensions.cs- Extension methods for registry operationsPublishConfiguration.cs- Now usesRegistryEndpointfor registry references andList<RegistryAuthentication>for auth lookupConfigurationExtensions.cs- AddedFindRegistryAuthentication()andGetRegistryResource()methodsPublishConfigurationBindingTests.cs- Tests for config binding from JSONFindRegistryAuthentication()Breaking change: appsettings.json/PublishConfiguration schema has changed.
RegistryAuthenticationis now a list keyed byServerinstead of a dictionary.