From 83e3c77505515e266640ee7e4deda64545b64de8 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 4 Apr 2024 10:11:23 -0700 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 8015 (#39536) * Use different service connection and az CLI for ACR auth * displayName --------- Co-authored-by: Daniel Jurek --- .../templates/steps/docker-pull-image.yml | 24 +++++++++++-------- .../steps/update-docsms-metadata.yml | 2 -- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/eng/common/pipelines/templates/steps/docker-pull-image.yml b/eng/common/pipelines/templates/steps/docker-pull-image.yml index fa22df31974be..61e59884f752a 100644 --- a/eng/common/pipelines/templates/steps/docker-pull-image.yml +++ b/eng/common/pipelines/templates/steps/docker-pull-image.yml @@ -1,15 +1,19 @@ parameters: - - name: ContainerRegistryClientId - type: string - - name: ContainerRegistryClientSecret + - name: ServiceConnectionName type: string + default: azuresdkimages_container-registry - name: ImageId type: string steps: -- pwsh: | - $containerRegistry = ("${{parameters.ImageId}}" -split "\/")[0] - docker login $containerRegistry -u "${{ parameters.ContainerRegistryClientId }}" -p "${{ parameters.ContainerRegistryClientSecret }}" - displayName: Login container registry -- pwsh: | - docker pull '${{ parameters.ImageId}}' - displayName: Pull docker image ${{ parameters.ImageId }} + - task: AzureCLI@2 + displayName: Docker Auth and Pull + inputs: + azureSubscription: ${{ parameters.ServiceConnectionName }} + scriptType: pscore + scriptLocation: inlineScript + inlineScript: | + # azuresdkimages.azurecr.io/pyrefautocr:latest -> azuresdkimages + $containerRegistryName = ("${{ parameters.ImageId }}" -split "\/")[0].Replace(".azurecr.io", "") + + az acr login --name $containerRegistryName + docker pull '${{ parameters.ImageId }}' diff --git a/eng/common/pipelines/templates/steps/update-docsms-metadata.yml b/eng/common/pipelines/templates/steps/update-docsms-metadata.yml index 63856f160cec4..d989426b69dd4 100644 --- a/eng/common/pipelines/templates/steps/update-docsms-metadata.yml +++ b/eng/common/pipelines/templates/steps/update-docsms-metadata.yml @@ -87,8 +87,6 @@ steps: - ${{ if ne(parameters.DocValidationImageId, '') }}: - template: /eng/common/pipelines/templates/steps/docker-pull-image.yml parameters: - ContainerRegistryClientId: $(azuresdkimages-cr-clientid) - ContainerRegistryClientSecret: $(azuresdkimages-cr-clientsecret) ImageId: '${{ parameters.DocValidationImageId }}' - pwsh: | $packageInfoJson = '${{ convertToJson(parameters.PackageInfoLocations) }}'.Trim('"').Replace("\\", "/")