summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2020-03-23 13:41:51 +0200
committerTimo Teräs <timo.teras@iki.fi>2021-04-11 13:58:08 +0300
commita13d2c21d0b3ad90e8c069e7d1812c17fa351f4b (patch)
tree463a8d4217b50de1fecb4c9e65be20710562d836
parent2564f778b478ea073c1544cce565ee6874779e2d (diff)
downloadapk-tools-a13d2c21d0b3ad90e8c069e7d1812c17fa351f4b.tar.gz
apk-tools-a13d2c21d0b3ad90e8c069e7d1812c17fa351f4b.tar.bz2
apk-tools-a13d2c21d0b3ad90e8c069e7d1812c17fa351f4b.tar.xz
apk-tools-a13d2c21d0b3ad90e8c069e7d1812c17fa351f4b.zip
build: inspect GitLab CI variables for version string
(cherry picked from commit b879d9ea5969a54b99e0780e699c4e72f3c9a78c)
-rw-r--r--Make.rules12
1 files changed, 9 insertions, 3 deletions
diff --git a/Make.rules b/Make.rules
index 695c068..39520fd 100644
--- a/Make.rules
+++ b/Make.rules
@@ -51,9 +51,15 @@ export srctree objtree
TAGPREFIX ?= v
-GIT_REV := $(shell test -d .git && git describe || echo exported)
-ifneq ($(GIT_REV), exported)
-FULL_VERSION := $(patsubst $(TAGPREFIX)%,%,$(GIT_REV))
+ifneq ($(CI_COMMIT_TAG),)
+FULL_VERSION := $(CI_COMMIT_TAG)
+else ifneq ($(CI_COMMIT_REF_NAME),)
+# GitLab but no tag info, use the 'git describe' from environment variable
+# once https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/1633
+# gets completed and merged upstream.
+FULL_VERSION := $(VERSION)
+else ifneq ($(wildcard .git),)
+FULL_VERSION := $(patsubst $(TAGPREFIX)%,%,$(shell git describe))
else
FULL_VERSION := $(VERSION)
endif