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

Make docker/image-tag work with multiple version tags #2748

Merged
merged 1 commit into from
Jan 16, 2020
Merged
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
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