Skip to content

ROX-26026: Make determine-image-tag recognize git tags #1920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 4, 2024
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
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)"
Loading