Skip to content

Commit 12cfb2b

Browse files
[ci] Set default ACR in UpgrateVersion/PR/official pipeline. (sonic-net#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.
1 parent a8f72e5 commit 12cfb2b

6 files changed

+34
-4
lines changed

.azure-pipelines/azure-pipelines-UpgrateVersion.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ parameters:
4545
stages:
4646
- stage: Build
4747
variables:
48-
CACHE_MODE: none
49-
VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS='
48+
- name: CACHE_MODE
49+
value: none
50+
- name: VERSION_CONTROL_OPTIONS
51+
value: 'SONIC_VERSION_CONTROL_COMPONENTS='
52+
- template: .azure-pipelines/template-variables.yml@buildimage
5053
jobs:
5154
- template: azure-pipelines-build.yml
5255
parameters:

.azure-pipelines/docker-sonic-slave-template.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ jobs:
3737
pool: ${{ parameters.pool }}
3838
steps:
3939
- template: cleanup.yml
40-
- template: .azure-pipelines/template-clean-sonic-slave.yml@buildimage
40+
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
41+
- template: template-clean-sonic-slave.yml
42+
- ${{ else }}:
43+
- template: .azure-pipelines/template-variables.yml@buildimage
4144
- checkout: self
4245
clean: true
4346
submodules: recursive

.azure-pipelines/official-build.yml

+11
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,20 @@ schedules:
1818
- 201911
1919
- 201811
2020

21+
resources:
22+
repositories:
23+
- repository: buildimage
24+
type: github
25+
name: Azure/sonic-buildimage
26+
ref: master
27+
endpoint: build
28+
2129
trigger: none
2230
pr: none
2331

32+
variables:
33+
- template: .azure-pipelines/template-variables.yml@buildimage
34+
2435
stages:
2536
- stage: Build
2637
pool: sonicbld
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
steps:
22
- script: |
3-
containers=$(docker container ls -a | grep "sonic-slave" | awk '{ print $1 }')
3+
set -x
4+
containers=$(docker container ls -aq)
45
[ -n "$containers" ] && docker container rm -f $containers
56
docker images | grep "^<none>" | awk '{print$3}' | xargs -i docker rmi {}
67
images=$(docker images 'sonic-slave-*' -a -q)
78
[ -n "$images" ] && docker rmi -f $images
9+
exit 0
810
displayName: 'Cleanup sonic slave'
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
variables:
2+
DEFAULT_CONTAINER_REGISTRY: 'publicmirror.azurecr.io'

azure-pipelines.yml

+9
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,18 @@ resources:
3030
type: github
3131
name: Azure/sonic-mgmt
3232
endpoint: build
33+
- repository: buildimage
34+
type: github
35+
name: Azure/sonic-buildimage
36+
endpoint: build
37+
ref: master
3338

3439
variables:
3540
- template: .azure-pipelines/azure-pipelines-repd-build-variables.yml
41+
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
42+
- template: .azure-pipelines/template-variables.yml
43+
- ${{ else }}:
44+
- template: .azure-pipelines/template-variables.yml@buildimage
3645
- name: CACHE_MODE
3746
value: rcache
3847

0 commit comments

Comments
 (0)