Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2748 from 2opremio/fix-image-tag
Browse files Browse the repository at this point in the history
Make docker/image-tag work with multiple version tags
  • Loading branch information
2opremio authored Jan 16, 2020
2 parents 09d904c + d906059 commit 834b13f
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions docker/image-tag
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,28 @@ if [ "${1:-}" = '--show-diff' ]; then
fi

# If a tagged version, just print that tag
HEAD_TAGS=$(git tag --points-at HEAD)
if [ -n "${HEAD_TAGS}" ] ; then
# remove helm- prefix from helm-op release name
if echo "${HEAD_TAGS}" | grep -Eq "helm-[0-9]+(\.[0-9]+)*(-[a-z]+)?$"; then
HEAD_TAGS=$(echo "$HEAD_TAGS" | cut -c 6-)
fi
echo ${HEAD_TAGS}
exit 0
fi
HEAD_TAGS=( $(git tag --points-at HEAD) )
case ${#HEAD_TAGS[@]} in
0) ;;

1) echo ${HEAD_TAGS[0]}; exit 0
;;

2) # For releases we may have two tags, one with an v prefix (e.g. v1.17.0 and 1.17.0),
# discard the v prefix
TAG1=${HEAD_TAGS[0]}
TAG2=${HEAD_TAGS[1]}
if [[ "${TAG1}" == v* && ${TAG1%$TAG2} == "v" ]]; then
echo ${TAG2}; exit 0
fi
if [[ "${TAG2}" == v* && ${TAG2%$TAG1} == "v" ]]; then
echo ${TAG1}; exit 0
fi
;&

*) echo "error: more than one tag pointing to HEAD" >&2; exit 1; ;;
esac



WORKING_SUFFIX=$(if ! git diff --exit-code ${OUTPUT} HEAD >&2; \
Expand Down

0 comments on commit 834b13f

Please sign in to comment.