From 838f4c4c737b3a0993fe62f3f441f7c7c3139254 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 20 Feb 2022 21:48:08 +0100 Subject: [PATCH] Be smarter about tag creation --- build.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 0535161..88c3172 100755 --- a/build.sh +++ b/build.sh @@ -6,8 +6,17 @@ docker build -t ungleich-hardware . while [ $# -ge 1 ]; do tag=$1; shift - git tag -a -m "Version $tag" $tag - git push --tags + # Does the tag exist? + if git rev-list "$tag" 2>/dev/null; then + cur=$(git describe) + if [ $cur != $tag ]; then + echo "Requested build for $tag, but we are on $cur, aborting" + exit 1 + fi + else + git tag -a -m "Version $tag" $tag + git push --tags + fi docker tag ungleich-hardware:latest ungleich/ungleich-hardware:${tag} docker tag ungleich-hardware:latest harbor.ungleich.svc.p10.k8s.ooo/ungleich-public/ungleich-hardware:${tag} docker push ungleich/ungleich-hardware:${tag}