Skip to content

Commit

Permalink
[ci] Use passwordless auth for darc/maestro
Browse files Browse the repository at this point in the history
Fixes: #9164

Migrates darc/maestro commands to use a passwordless auth flow, as token
based authentication is deprecated and will be removed in the future.
  • Loading branch information
pjcollins committed Aug 8, 2024
1 parent 99ba813 commit b30945f
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -599,23 +599,30 @@ extends:
arguments: -c $(XA.Build.Configuration) -bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\bootstrap.binlog
condition: and(succeeded(), eq('${{ parameters.pushXAPackagesToMaestro }}', 'true'))

- task: DotNetCoreCLI@2
- task: AzureCLI@2
displayName: generate and publish BAR manifest
inputs:
projects: $(System.DefaultWorkingDirectory)\build-tools\create-packs\Microsoft.Android.Sdk.proj
arguments: >-
azureSubscription: "Darc: Maestro Production"
scriptType: pscore
scriptLocation: inlineScript
inlineScript: >-
dotnet build $(System.DefaultWorkingDirectory)\build-tools\create-packs\Microsoft.Android.Sdk.proj
-t:PushManifestToBuildAssetRegistry
-p:BuildAssetRegistryToken=$(MaestroAccessToken)
-p:OutputPath=$(Build.StagingDirectory)\nuget-signed\
-c $(XA.Build.Configuration) -bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\push-bar-manifest.binlog
condition: and(succeeded(), eq('${{ parameters.pushXAPackagesToMaestro }}', 'true'))

- powershell: |
$versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16'
$darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content
$arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
& dotnet tool update microsoft.dotnet.darc --version "$darcVersion" --add-source "$arcadeServicesSource" --tool-path $(Agent.ToolsDirectory)\darc -v n
& $(Agent.ToolsDirectory)\darc\darc add-build-to-channel --default-channels --id $(BARBuildId) --publishing-infra-version 3 --password $(MaestroAccessToken) --azdev-pat $(publishing-dnceng-devdiv-code-r-build-re)
- task: AzureCLI@2
inputs:
azureSubscription: "Darc: Maestro Production"
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
$versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16'
$darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content
$arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
& dotnet tool update microsoft.dotnet.darc --version "$darcVersion" --add-source "$arcadeServicesSource" --tool-path $(Agent.ToolsDirectory)\darc -v n
& $(Agent.ToolsDirectory)\darc\darc add-build-to-channel --default-channels --id $(BARBuildId) --publishing-infra-version 3
displayName: add build to default darc channel
condition: and(succeeded(), eq('${{ parameters.pushXAPackagesToMaestro }}', 'true'))

Expand Down

0 comments on commit b30945f

Please sign in to comment.