Skip to content

Commit

Permalink
Login and Pull docker image. (#2179)
Browse files Browse the repository at this point in the history
Azure/azure-sdk-for-js#18405

Docs is switching the validation using docker container. Here is the common logic to pull image from Azure container register.

Testing pipeline in use with the script:
https://dev.azure.com/azure-sdk/internal/_build/results?buildId=1172146&view=logs&j=dc056dfc-c0cf-5958-c8c4-8da4f91a3739&t=bfb6cede-7671-5504-0a11-79b13ef63703
  • Loading branch information
sima-zhu authored Nov 2, 2021
1 parent 7bf9eac commit 54729b3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
15 changes: 15 additions & 0 deletions eng/common/pipelines/templates/steps/docker-pull-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
parameters:
- name: ContainerRegistryClientId
type: string
- name: ContainerRegistryClientSecret
type: string
- 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 }}
9 changes: 8 additions & 1 deletion eng/common/scripts/Update-DocsMsPackages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@ docs generation from pacakges which are not published to the default feed). This
variable is meant to be used in the domain-specific business logic in
&$UpdateDocsMsPackagesFn
.PARAMETER ImageId
Optional The docker image for package validation in format of '$containerRegistry/$imageName:$tag'.
e.g. azuresdkimages.azurecr.io/jsrefautocr:latest
#>
param (
[Parameter(Mandatory = $true)]
[string] $DocRepoLocation, # the location of the cloned doc repo

[Parameter(Mandatory = $false)]
[string] $PackageSourceOverride
[string] $PackageSourceOverride,

[Parameter(Mandatory = $false)]
[string] $ImageId
)

. (Join-Path $PSScriptRoot common.ps1)
Expand Down

0 comments on commit 54729b3

Please sign in to comment.