Skip to content

Commit

Permalink
Use service connection for MAR ingestion and use .default scope (#1287)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbussell authored May 15, 2024
1 parent 51da240 commit 538c35c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 2 additions & 0 deletions eng/common/templates/steps/wait-for-mcr-image-ingestion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ steps:
parameters:
displayName: Wait for Image Ingestion
condition: and(${{ parameters.condition }}, eq(variables['waitForIngestionEnabled'], 'true'))
serviceConnection: $(marStatus.serviceConnectionName)
internalProjectName: 'internal'
args: >
waitForMcrImageIngestion
'${{ parameters.imageInfoPath }}'
Expand Down
13 changes: 3 additions & 10 deletions src/Microsoft.DotNet.ImageBuilder/src/McrStatusClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.DotNet.ImageBuilder
[Export(typeof(IMcrStatusClient))]
public class McrStatusClient : IMcrStatusClient
{
private const string McrStatusResource = "api://c00053c3-a979-4ee6-b94e-941881e62d8e";
private const string McrStatusResource = "api://c00053c3-a979-4ee6-b94e-941881e62d8e/.default";
// https://msazure.visualstudio.com/MicrosoftContainerRegistry/_git/docs?path=/status/status_v2.yaml
private const string BaseUri = "https://status.mscr.io/api/onboardingstatus/v2";
private readonly HttpClient _httpClient;
Expand All @@ -27,15 +27,8 @@ public class McrStatusClient : IMcrStatusClient
[ImportingConstructor]
public McrStatusClient(IHttpClientProvider httpClientProvider, ILoggerService loggerService)
{
if (loggerService is null)
{
throw new ArgumentNullException(nameof(loggerService));
}

if (httpClientProvider is null)
{
throw new ArgumentNullException(nameof(httpClientProvider));
}
ArgumentNullException.ThrowIfNull(loggerService);
ArgumentNullException.ThrowIfNull(httpClientProvider);

_httpClient = httpClientProvider.GetClient();
_httpPolicy = HttpPolicyBuilder.Create()
Expand Down

0 comments on commit 538c35c

Please sign in to comment.