This is an automated email from the ASF dual-hosted git repository.
rshah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new 13488f86e3 Get build number from BUILD_NUMBER file if not in a repo
(#7922)
13488f86e3 is described below
commit 13488f86e3e14b8e0d6d8a8403b59032f86a0482
Author: Zach Hoffman <[email protected]>
AuthorDate: Wed Jan 24 08:35:14 2024 -0700
Get build number from BUILD_NUMBER file if not in a repo (#7922)
* Break $(shell) function into multiple lines for readability
* Get build number from BUILD_NUMBER file if not in a git repo
---
infrastructure/cdn-in-a-box/Makefile | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/infrastructure/cdn-in-a-box/Makefile
b/infrastructure/cdn-in-a-box/Makefile
index 35b900c890..7129d86c8f 100644
--- a/infrastructure/cdn-in-a-box/Makefile
+++ b/infrastructure/cdn-in-a-box/Makefile
@@ -40,7 +40,21 @@ TC_DIR := $(CIAB_DIR_RELATIVE)../..
PKG_COMMAND := $(TC_DIR)/pkg
PKG_FLAGS := -v -$(RHEL_VERSION)
BUILD_SUFFIX := _build
-BUILD_NUMBER := $(shell bash -c 'set -o pipefail -o xtrace; git describe
--long --tags --match="RELEASE-[0-9].[0-9].[0-9]"
--match="RELEASE-[0-9][0-9].[0-9][0-9].[0-9][0-9]" --match="v[0-9].[0-9].[0-9]"
--match="v[0-9][0-9].[0-9][0-9].[0-9][0-9]" | awk -F- "{print \$$(NF-1)}"' ||
echo 0).$(shell git rev-parse --short=8 HEAD)
+BUILD_NUMBER := $(shell bash -c ' \
+ set -o errexit -o pipefail -o xtrace; \
+ git rev-parse --is-inside-work-tree >/dev/null; \
+ output="$$(git describe \
+ --long \
+ --tags \
+ --match="RELEASE-[0-9].[0-9].[0-9]" \
+ --match="RELEASE-[0-9][0-9].[0-9][0-9].[0-9][0-9]" \
+ --match="v[0-9].[0-9].[0-9]" \
+ --match="v[0-9][0-9].[0-9][0-9].[0-9][0-9]" | \
+ awk -F- "{print \$$(NF-1)}" || \
+ echo 0)"; \
+ output+=".$$(git rev-parse --short=8 HEAD)"; \
+ echo "$$output"' || \
+ cat $(TC_DIR)/BUILD_NUMBER)
BUILD_ARCH := $(shell docker run
--name=ciab-get-$(BASE_IMAGE)-$(RHEL_VERSION)-arch --rm
$(BASE_IMAGE):$(RHEL_VERSION) rpm --eval %_arch )
TC_VERSION := $(shell cat "$(TC_DIR)/VERSION")
TOMCAT_VERSION := $(shell grep '^\s*TOMCAT_VERSION='
"$(TC_DIR)/traffic_router/build/build_rpm.sh" | cut -d= -f2)