Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sonic slave pipeline to set correct tag on sonic slave image. #13177

Merged
merged 10 commits into from
Dec 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .azure-pipelines/docker-sonic-slave-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ parameters:
- sonicbld-armhf

jobs:
- job: Build_${{ parameters.dist }}_${{ parameters.march }}${{ parameters.arch }}
- job: sonic_slave_${{ parameters.dist }}${{ parameters.march }}
timeoutInMinutes: 360
variables:
- template: /.azure-pipelines/template-variables.yml@buildimage
Expand All @@ -46,7 +46,6 @@ jobs:
- template: /.azure-pipelines/template-clean-sonic-slave.yml@buildimage
- checkout: self
clean: true
submodules: recursive
- task: Docker@2
displayName: Login to ACR
inputs:
Expand All @@ -56,6 +55,9 @@ jobs:
set -ex
image_tag=$(BLDENV=${{ parameters.dist }} make -f Makefile.work showtag PLATFORM=generic PLATFORM_ARCH=${{ parameters.arch }} | grep sonic-slave | tail -n 1)
image_latest=$(echo $(echo $image_tag | awk -F: '{print$1}'):latest)
if echo ${{ parameters.pool }} | grep ${{ parameters.arch }};then
image_latest=$(echo ${image_latest} | sed 's/:/-${{ parameters.arch }}:/')
fi
image_branch=$(echo $(echo $image_tag | awk -F: '{print$1}'):$(Build.SourceBranchName))
docker rmi $image_tag || true

Expand All @@ -72,7 +74,7 @@ jobs:
docker push ${REGISTRY_SERVER}/${image_tag}
docker tag ${image_tag} ${REGISTRY_SERVER}/${image_branch}
docker push ${REGISTRY_SERVER}/${image_branch}
if [[ "${{ parameters.arch }}" == "amd64" ]] && [[ "$(Build.SourceBranchName)" == "master" ]];then
if [[ "$(Build.SourceBranchName)" == "master" ]];then
docker tag ${image_tag} ${REGISTRY_SERVER}/${image_latest}
docker push ${REGISTRY_SERVER}/${image_latest}
fi
Expand Down
8 changes: 5 additions & 3 deletions .azure-pipelines/docker-sonic-slave.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ parameters:
default: sonicdev

stages:
- stage: Build
- stage: Build_in_amd64
jobs:
- ${{ each dist in parameters.dists }}:
- ${{ if endswith(variables['Build.DefinitionName'], dist) }}:
Expand All @@ -66,7 +66,9 @@ stages:
pool: sonicbld
arch: ${{ arch }}
dist: ${{ dist }}
- stage: Build_march
${{ if ne(arch, 'amd64') }}:
march: _march_${{ arch }}
- stage: Build_native_arm
dependsOn: []
jobs:
- ${{ each dist in parameters.dists }}:
Expand All @@ -78,4 +80,4 @@ stages:
pool: sonicbld-${{ arch }}
arch: ${{ arch }}
dist: ${{ dist }}
march: march_
march: _${{ arch }}