[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 GitHub
parent a8f72e5d45
commit 12cfb2b8f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 4 deletions

View File

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

View File

@ -37,7 +37,10 @@ jobs:
pool: ${{ parameters.pool }} pool: ${{ parameters.pool }}
steps: steps:
- template: cleanup.yml - 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 - checkout: self
clean: true clean: true
submodules: recursive submodules: recursive

View File

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

View File

@ -1,8 +1,10 @@
steps: steps:
- script: | - script: |
containers=$(docker container ls -a | grep "sonic-slave" | awk '{ print $1 }') set -x
containers=$(docker container ls -aq)
[ -n "$containers" ] && docker container rm -f $containers [ -n "$containers" ] && docker container rm -f $containers
docker images | grep "^<none>" | awk '{print$3}' | xargs -i docker rmi {} docker images | grep "^<none>" | awk '{print$3}' | xargs -i docker rmi {}
images=$(docker images 'sonic-slave-*' -a -q) images=$(docker images 'sonic-slave-*' -a -q)
[ -n "$images" ] && docker rmi -f $images [ -n "$images" ] && docker rmi -f $images
exit 0
displayName: 'Cleanup sonic slave' 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 type: github
name: Azure/sonic-mgmt name: Azure/sonic-mgmt
endpoint: build endpoint: build
- repository: buildimage
type: github
name: Azure/sonic-buildimage
endpoint: build
ref: master
variables: variables:
- template: .azure-pipelines/azure-pipelines-repd-build-variables.yml - 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 - name: CACHE_MODE
value: rcache value: rcache