Skip to content
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

build: INFENG-926: Fix version.sh version string output #10085

Merged
merged 16 commits into from
Oct 21, 2024
12 changes: 11 additions & 1 deletion version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fi
if [[ -z ${VERSION} ]]; then
# Check if this branch has any tags (typically, only release branches will
# have tags).
MAYBE_TAG=$(git describe --tags --abbrev=0 2>/dev/null | grep -Eo 'v?\d+\.\d+\.\d+')
MAYBE_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
SHA=$(git rev-parse --short HEAD)

# No tag on current branch.
Expand All @@ -92,6 +92,16 @@ if [[ -z ${VERSION} ]]; then
)
fi

# Filter out additional +metadata from the tag, should it
# exist. This prevents version strings like
# 0.751.0+dryrun+27a014b44.
# Note: we use [0-9] instead of \d here, because while BSD grep's
# -E includes the \d character class, GNU grep's -E does not. This
# means using \d on macOS will work fine, but it will break on
# Linux (and thus, CI). To avoid this, we fall back to standard
# character sets.
MAYBE_TAG=$(grep -Eo 'v?[0-9]+\.[0-9]+\.[0-9]+' <(printf "%s" "$MAYBE_TAG"))

# Munge the tag into the form we want. Note: we always append a SHA hash,
# even if we're on the commit with the tag. This is partially because I feel
# like it will be more consistent and result in fewer surprises, but also it
Expand Down
Loading