-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use different service connection and az CLI for ACR auth
- Loading branch information
1 parent
2f251a3
commit 5a7f89e
Showing
2 changed files
with
14 additions
and
12 deletions.
There are no files selected for viewing
24 changes: 14 additions & 10 deletions
24
eng/common/pipelines/templates/steps/docker-pull-image.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: Authenticate to Container Registry | ||
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 }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters