You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor ACR authentication to use Azure SDK TokenCredential
- Add LoginToRegistryAsync method to IContainerRuntime interface
- Implement LoginToRegistryAsync in ContainerRuntimeBase with stdin support
- Add StandardInputContent to ProcessSpec and update ProcessUtil to handle it
- Update FakeContainerRuntime for testing
- Refactor AzureEnvironmentResourceHelpers to use IContainerRuntime and ITokenCredentialProvider
- Use TokenCredential to acquire ACR access token (scope: https://containerregistry.azure.com/.default)
- Login with username 00000000-0000-0000-0000-000000000000 and token as password
- Add InternalsVisibleTo for Azure projects to access IContainerRuntime
- Remove duplicate shared file compile links from Azure projects
- Log process output with PipelineStepContext.Logger at debug level
- Throw exception on non-zero exit code to fail overall step
Co-authored-by: davidfowl <[email protected]>
awaitloginTask.FailAsync($"Login to ACR **{registryName}** failed with exit code {result.ExitCode}",cancellationToken:cancellationToken).ConfigureAwait(false);
63
-
}
64
-
else
65
-
{
66
-
awaitloginTask.CompleteAsync($"Successfully logged in to **{registryName}**",CompletionState.Completed,cancellationToken).ConfigureAwait(false);
67
-
}
68
-
}
57
+
awaitloginTask.CompleteAsync($"Successfully logged in to **{registryEndpoint}**",CompletionState.Completed,cancellationToken).ConfigureAwait(false);
69
58
}
70
-
catch(Exception)
59
+
catch(Exceptionex)
71
60
{
61
+
awaitloginTask.FailAsync($"Login to ACR **{registryEndpoint}** failed: {ex.Message}",cancellationToken:cancellationToken).ConfigureAwait(false);
logger.LogError("{RuntimeName} login to {RegistryServer} failed with exit code {ExitCode}.",containerRuntime.Name,registryServer,processResult.ExitCode);
98
+
thrownewDistributedApplicationException($"{containerRuntime.Name} login failed with exit code {processResult.ExitCode}.");
99
+
}
100
+
101
+
logger.LogDebug("{RuntimeName} login to {RegistryServer} succeeded.",containerRuntime.Name,registryServer);
0 commit comments