From 66b2d78305d07ba1ca7f2844696d372bd424c465 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Mon, 14 May 2018 09:33:30 -0700 Subject: [PATCH] build: only match version tags for BUILD_SCM_VERSION (#23903) PR Close #23903 --- tools/bazel_stamp_vars.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/bazel_stamp_vars.sh b/tools/bazel_stamp_vars.sh index 2e70a4c1f0..3092f6c6cb 100755 --- a/tools/bazel_stamp_vars.sh +++ b/tools/bazel_stamp_vars.sh @@ -26,7 +26,10 @@ if [[ "$(git tag)" == "" ]]; then echo "" fi -BUILD_SCM_VERSION_RAW=$(git describe --abbrev=7 --tags HEAD) +# Only match the latest tag that is a version such as 6.0.0, 6.0.0-rc.5, etc... +# This will ignore non-version tags which would break unit tests expecting a valid version +# number in the package headers +BUILD_SCM_VERSION_RAW=$(git describe --match [0-9].[0-9].[0-9]* --abbrev=7 --tags HEAD) # Find out if there are any uncommitted local changes # TODO(i): is it ok to use "--untracked-files=no" to ignore untracked files since they should not affect anything?