Skip to content

Commit

Permalink
ROX-26026: Backport #1920 git tags handling (#1931)
Browse files Browse the repository at this point in the history
  • Loading branch information
msugakov authored Nov 4, 2024
1 parent 38675de commit 1ab1ebc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .tekton/determine-image-tag-task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,15 @@ spec:
dnf -y install git make
.konflux/scripts/fail-build-if-git-is-dirty.sh
echo -n "$(make --quiet --no-print-directory tag)$(params.TAG_SUFFIX)" | tee "$(results.IMAGE_TAG.path)"
# First, try take git tag if it's a tagged commit.
tag="$(git tag --points-at)"
if [[ -z "$tag" ]]; then
# If not, use make target's output.
tag="$(make --quiet --no-print-directory tag)"
elif [[ "$(wc -l <<< "$tag")" -gt 1 ]]; then
>&2 echo -e "Error: the HEAD commit has multiple tags, don't know which one to choose:\n$tag"
exit 5
fi
echo -n "${tag}$(params.TAG_SUFFIX)" | tee "$(results.IMAGE_TAG.path)"

0 comments on commit 1ab1ebc

Please sign in to comment.