Skip to content

Commit

Permalink
[ci] Set default ACR in UpgrateVersion/PR/official pipeline. (#10341)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
liushilongbuaa committed Apr 1, 2022
1 parent a8f72e5 commit 12cfb2b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .azure-pipelines/azure-pipelines-UpgrateVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion .azure-pipelines/docker-sonic-slave-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,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
Expand Down
11 changes: 11 additions & 0 deletions .azure-pipelines/official-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion .azure-pipelines/template-clean-sonic-slave.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
steps:
- 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
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'
2 changes: 2 additions & 0 deletions .azure-pipelines/template-variables.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
variables:
DEFAULT_CONTAINER_REGISTRY: 'publicmirror.azurecr.io'
9 changes: 9 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 12cfb2b

Please sign in to comment.