[ci] Add branch tag on sonic-slave-bullseye image. (#13151)
Why I did it tag sonic-slave-* image with branch. Only keep sonic-slave-* latest tag when it is master branch and amd64 arch. How I did it How to verify it
This commit is contained in:
parent
948ce3fe09
commit
449ae1332f
@ -56,6 +56,7 @@ jobs:
|
|||||||
set -ex
|
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_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)
|
image_latest=$(echo $(echo $image_tag | awk -F: '{print$1}'):latest)
|
||||||
|
image_branch=$(echo $(echo $image_tag | awk -F: '{print$1}'):$(Build.SourceBranchName))
|
||||||
docker rmi $image_tag || true
|
docker rmi $image_tag || true
|
||||||
|
|
||||||
if [[ "$(Build.Reason)" =~ [a-zA-Z]*CI ]] && docker pull ${{ parameters.registry_url }}/${image_tag};then
|
if [[ "$(Build.Reason)" =~ [a-zA-Z]*CI ]] && docker pull ${{ parameters.registry_url }}/${image_tag};then
|
||||||
@ -69,7 +70,9 @@ jobs:
|
|||||||
|
|
||||||
docker tag ${image_tag} ${REGISTRY_SERVER}/${image_tag}
|
docker tag ${image_tag} ${REGISTRY_SERVER}/${image_tag}
|
||||||
docker push ${REGISTRY_SERVER}/${image_tag}
|
docker push ${REGISTRY_SERVER}/${image_tag}
|
||||||
if [[ "${{ parameters.arch }}" == "amd64" ]];then
|
docker tag ${image_tag} ${REGISTRY_SERVER}/${image_branch}
|
||||||
|
docker push ${REGISTRY_SERVER}/${image_branch}
|
||||||
|
if [[ "${{ parameters.arch }}" == "amd64" ]] && [[ "$(Build.SourceBranchName)" == "master" ]];then
|
||||||
docker tag ${image_tag} ${REGISTRY_SERVER}/${image_latest}
|
docker tag ${image_tag} ${REGISTRY_SERVER}/${image_latest}
|
||||||
docker push ${REGISTRY_SERVER}/${image_latest}
|
docker push ${REGISTRY_SERVER}/${image_latest}
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user