Skip to content

Commit 60365bf

Browse files
Fix sonic slave pipeline to set correct tag on sonic slave image. (#13177) (#13186)
Why I did it Currently sonic-slave-* tag is confusing. Set correct tag on sonic-slave-* image. Fix job name to fit the build. How I did it build amd image in amd64: sonic-slave-bullseye:cfe29bff67c sonic-slave-bullseye:latest sonic-slave-bullseye:master build armhf image in amd64: sonic-slave-bullseye-march-armhf:33614806dc3 sonic-slave-bullseye-march-armhf:latest sonic-slave-bullseye-march-armhf:master build arm64 image in amd64: sonic-slave-bullseye-march-arm64:f3b1b16c801 sonic-slave-bullseye-march-arm64:latest sonic-slave-bullseye-march-arm64:master build arm64 image in arm64: sonic-slave-bullseye:75cb326c9a7 sonic-slave-bullseye-arm64:latest sonic-slave-bullseye:master build armhf image in armhf: sonic-slave-bullseye:64d178951fc sonic-slave-bullseye-armhf:latest sonic-slave-bullseye:master How to verify it
1 parent 5a93494 commit 60365bf

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

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

+8-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ parameters:
3535
- sonicbld-armhf
3636

3737
jobs:
38-
- job: Build_${{ parameters.dist }}_${{ parameters.march }}${{ parameters.arch }}
38+
- job: sonic_slave_${{ parameters.dist }}${{ parameters.march }}
3939
timeoutInMinutes: 360
4040
variables:
4141
- template: /.azure-pipelines/template-variables.yml@buildimage
@@ -46,7 +46,6 @@ jobs:
4646
- template: /.azure-pipelines/template-clean-sonic-slave.yml@buildimage
4747
- checkout: self
4848
clean: true
49-
submodules: recursive
5049
- task: Docker@2
5150
displayName: Login to ACR
5251
inputs:
@@ -56,6 +55,10 @@ jobs:
5655
set -ex
5756
image_tag=$(BLDENV=${{ parameters.dist }} make -f Makefile.work showtag PLATFORM=generic PLATFORM_ARCH=${{ parameters.arch }} | grep sonic-slave | tail -n 1)
5857
image_latest=$(echo $(echo $image_tag | awk -F: '{print$1}'):latest)
58+
if echo ${{ parameters.pool }} | grep ${{ parameters.arch }};then
59+
image_latest=$(echo ${image_latest} | sed 's/:/-${{ parameters.arch }}:/')
60+
fi
61+
image_branch=$(echo $(echo $image_latest | awk -F: '{print$1}'):$(Build.SourceBranchName))
5962
docker rmi $image_tag || true
6063
6164
if [[ "$(Build.Reason)" =~ [a-zA-Z]*CI ]] && docker pull ${{ parameters.registry_url }}/${image_tag};then
@@ -69,7 +72,9 @@ jobs:
6972
7073
docker tag ${image_tag} ${REGISTRY_SERVER}/${image_tag}
7174
docker push ${REGISTRY_SERVER}/${image_tag}
72-
if [[ "${{ parameters.arch }}" == "amd64" ]];then
75+
docker tag ${image_tag} ${REGISTRY_SERVER}/${image_branch}
76+
docker push ${REGISTRY_SERVER}/${image_branch}
77+
if [[ "$(Build.SourceBranchName)" == "master" ]];then
7378
docker tag ${image_tag} ${REGISTRY_SERVER}/${image_latest}
7479
docker push ${REGISTRY_SERVER}/${image_latest}
7580
fi

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ trigger:
3030
paths:
3131
include:
3232
- sonic-slave-*
33-
- src/sonic-build-hooks
3433
- files/build/versions
3534
- Makefile
3635
- Makefile.work
@@ -57,7 +56,7 @@ parameters:
5756
default: sonicdev
5857

5958
stages:
60-
- stage: Build
59+
- stage: Build_in_amd64
6160
jobs:
6261
- ${{ each dist in parameters.dists }}:
6362
- ${{ if endswith(variables['Build.DefinitionName'], dist) }}:
@@ -67,7 +66,9 @@ stages:
6766
pool: sonicbld
6867
arch: ${{ arch }}
6968
dist: ${{ dist }}
70-
- stage: Build_march
69+
${{ if ne(arch, 'amd64') }}:
70+
march: _march_${{ arch }}
71+
- stage: Build_native_arm
7172
dependsOn: []
7273
jobs:
7374
- ${{ each dist in parameters.dists }}:
@@ -79,4 +80,4 @@ stages:
7980
pool: sonicbld-${{ arch }}
8081
arch: ${{ arch }}
8182
dist: ${{ dist }}
82-
march: march_
83+
march: _${{ arch }}

0 commit comments

Comments
 (0)