We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6e75b71 commit 6b1dfbbCopy full SHA for 6b1dfbb
.tekton/determine-image-tag-task.yaml
@@ -41,4 +41,15 @@ spec:
41
dnf -y install git make
42
43
scripts/konflux/fail-build-if-git-is-dirty.sh
44
- echo -n "$(make --quiet --no-print-directory tag)$(params.TAG_SUFFIX)" | tee "$(results.IMAGE_TAG.path)"
+
45
+ # First, try take git tag if it's a tagged commit.
46
+ tag="$(git tag --points-at)"
47
+ if [[ -z "$tag" ]]; then
48
+ # If not, use make target's output.
49
+ tag="$(make --quiet --no-print-directory tag)"
50
+ elif [[ "$(wc -l <<< "$tag")" -gt 1 ]]; then
51
+ >&2 echo -e "Error: the HEAD commit has multiple tags, don't know which one to choose:\n$tag"
52
+ exit 5
53
+ fi
54
55
+ echo -n "${tag}$(params.TAG_SUFFIX)" | tee "$(results.IMAGE_TAG.path)"
0 commit comments