From 82edb0e92da0e31052caa994b0f7e14ce3f02985 Mon Sep 17 00:00:00 2001 From: Petr Kotas Date: Tue, 17 Aug 2021 12:02:35 +0200 Subject: [PATCH] Build and push tagged aro image into ACR When annotated TAG is not set the new step fails. Otherwise it builds the tagged image and pushes it to the ACR. Signed-off-by: Petr Kotas --- .../template-push-images-to-acr-tagged.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .pipelines/templates/template-push-images-to-acr-tagged.yml diff --git a/.pipelines/templates/template-push-images-to-acr-tagged.yml b/.pipelines/templates/template-push-images-to-acr-tagged.yml new file mode 100644 index 000000000..b12b8409d --- /dev/null +++ b/.pipelines/templates/template-push-images-to-acr-tagged.yml @@ -0,0 +1,15 @@ +parameters: + rpImageACR: '' + imageTag: '' +steps: +- script: | + set -e + trap 'set +e; for c in $(docker ps -aq); do docker rm -f $c; done; docker image prune -af ; rm -rf ~/.docker/config.json' EXIT + + export RP_IMAGE_ACR=${{ parameters.rpImageACR }} + export TAG=${{ parameters.imageTag }} + az acr login --name "$RP_IMAGE_ACR" + # azure checkouts commit, so removing master reference when publishing image + export BRANCH=$(Build.SourceBranchName) + make publish-image-aro-tag + displayName: ⚙️ Build and push tagged images to ACR