[ci] Set default ACR in UpgrateVersion/PR/official pipeline. (#10341)

Why I did it
docker hub will limit the pull rate.
Use ACR instead to pull debian related docker image.

How I did it
Set DEFAULT_CONTAINER_REGISTRY in pipeline.
This commit is contained in:
Shilong Liu 2022-04-02 07:48:44 +08:00 committed by xumia
parent a3aa8041b9
commit 9008132871
6 changed files with 41 additions and 3 deletions

View File

@ -45,8 +45,11 @@ parameters:
stages:
- stage: Build
variables:
CACHE_MODE: none
VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS='
- name: CACHE_MODE
value: none
- name: VERSION_CONTROL_OPTIONS
value: 'SONIC_VERSION_CONTROL_COMPONENTS='
- template: .azure-pipelines/template-variables.yml@buildimage
jobs:
- template: azure-pipelines-build.yml
parameters:

View File

@ -45,7 +45,10 @@ jobs:
pool: ${{ parameters.pool }}
steps:
- template: cleanup.yml
- template: .azure-pipelines/template-clean-sonic-slave.yml@buildimage
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- template: template-clean-sonic-slave.yml
- ${{ else }}:
- template: .azure-pipelines/template-variables.yml@buildimage
- checkout: self
clean: true
submodules: recursive

View File

@ -18,9 +18,20 @@ schedules:
- 201911
- 201811
resources:
repositories:
- repository: buildimage
type: github
name: Azure/sonic-buildimage
ref: master
endpoint: build
trigger: none
pr: none
variables:
- template: .azure-pipelines/template-variables.yml@buildimage
stages:
- stage: Build
pool: sonicbld

View File

@ -0,0 +1,10 @@
steps:
- script: |
set -x
containers=$(docker container ls -aq)
[ -n "$containers" ] && docker container rm -f $containers
docker images | grep "^<none>" | awk '{print$3}' | xargs -i docker rmi {}
images=$(docker images 'sonic-slave-*' -a -q)
[ -n "$images" ] && docker rmi -f $images
exit 0
displayName: 'Cleanup sonic slave'

View File

@ -0,0 +1,2 @@
variables:
DEFAULT_CONTAINER_REGISTRY: 'publicmirror.azurecr.io'

View File

@ -30,9 +30,18 @@ resources:
type: github
name: Azure/sonic-mgmt
endpoint: build
- repository: buildimage
type: github
name: Azure/sonic-buildimage
endpoint: build
ref: master
variables:
- template: .azure-pipelines/azure-pipelines-repd-build-variables.yml
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
- template: .azure-pipelines/template-variables.yml
- ${{ else }}:
- template: .azure-pipelines/template-variables.yml@buildimage
- name: CACHE_MODE
value: rcache