Skip to content

Re-apply dry-run fix for CopyImageService publish config lookup#1972

Merged
lbussell merged 2 commits intodotnet:mainfrom
lbussell:fix/copy-image-dry-run-v2
Feb 19, 2026
Merged

Re-apply dry-run fix for CopyImageService publish config lookup#1972
lbussell merged 2 commits intodotnet:mainfrom
lbussell:fix/copy-image-dry-run-v2

Conversation

@lbussell
Copy link
Member

Problem

PR #1966 fixed CopyImageService.ImportImageAsync to skip the PublishConfiguration lookup in dry-run mode. This fix was inadvertently reverted by the logging migration in #1968 due to a bad merge.

This causes CopyBaseImages and CopyAcrImages to fail in PR validation pipelines with:

System.InvalidOperationException: No authentication details found for source registry '$(acr-staging-test.server)'.
Ensure the registry is configured in the publish configuration.

In PR builds, appsettings.json is intentionally not generated (the generate-appsettings.yml step skips for PRs), so PublishConfiguration.RegistryAuthentication is empty. The GetRegistryResource call was happening before the isDryRun check, so even dry-run mode required a fully populated config.

Changes

  1. Test — Added CopyImageServiceTests with a test that exercises ImportImageAsync in dry-run mode with an empty PublishConfiguration, verifying it does not throw.
  2. Fix — Moved GetRegistryResource calls and all Azure import logic after an early return for isDryRun, so dry-run mode only logs what would happen without requiring registry authentication details.

Fixes pipeline failures in #1963.

lbussell and others added 2 commits February 18, 2026 15:51
Verifies that ImportImageAsync succeeds in dry-run mode when
PublishConfiguration has no RegistryAuthentication entries. This
scenario occurs in PR validation pipelines where appsettings.json
is not generated.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move GetRegistryResource calls after the dry-run early return so that
dry-run mode does not require a populated PublishConfiguration. This
fixes CopyBaseImages and CopyAcrImages failures in PR validation
pipelines where appsettings.json is not generated.

This fix was originally applied in dotnet#1966 but was inadvertently reverted
by the logging migration in dotnet#1968.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lbussell lbussell requested a review from a team as a code owner February 18, 2026 23:57
Copy link
Member

@nagilson nagilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good, but left a few comments worth addressing. Thanks!

Copy link
Member

@joeloff joeloff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not familiar with the code, just going off the description and changes you linked

@lbussell lbussell merged commit a825723 into dotnet:main Feb 19, 2026
12 checks passed
@lbussell lbussell deleted the fix/copy-image-dry-run-v2 branch February 19, 2026 17:59
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.

3 participants

Comments