diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-11-14 10:30:19 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-12-15 15:59:58 +0300 |
commit | 9e5e151f814d4465506ea79187ae89fb61a5532e (patch) | |
tree | f0f2002104e560e4be32ed42d1d612bea9a74b1a | |
parent | d931585a91be42e1902f880162a49713940c82e9 (diff) |
Makefile: Fix broken Git version in nightly CI jobs
In our nightly CI jobs we test with Git's `main` respectivey `next`
branch. Starting with 8bd7becbb (Makefile: Use Gitaly's tagged Git
versions instead of ad-hoc patching, 2022-11-11), we unconditionally
write the `GIT_VERSION` into Git's source tree to override the version
that e.g. `git --version` would report. But when `GIT_VERSION=master`,
then we fail to parse the Git version in Gitaly and thus fail all code
paths that depend on this.
Fix this by introducing a new variable that, if set, skips overriding
the Git version. This variable is set in our nightly jobs now.
-rw-r--r-- | .gitlab-ci.yml | 3 | ||||
-rw-r--r-- | Makefile | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1470ac844..e66497f26 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -250,6 +250,9 @@ test:pgbouncer: test:nightly: <<: *test_definition + variables: + <<: *test_variables + SKIP_OVERRIDING_GIT_VERSION: "YesPlease" parallel: matrix: - GIT_VERSION: [ "master", "next" ] @@ -138,6 +138,11 @@ GIT_VERSION_2_37_1 ?= v2.37.1.gl1 ## The Git version used for bundled Git v2.38. GIT_VERSION_2_38 ?= v2.38.1.gl0 +## Skip overriding the Git version and instead use the Git version as specified +## in the Git sources. This is required when building Git from a version that +## cannot be parsed by Gitaly. +SKIP_OVERRIDING_GIT_VERSION ?= + # The default version is used in case the caller does not set the variable or # if it is either set to the empty string or "default". ifeq (${GIT_VERSION:default=},) @@ -654,10 +659,14 @@ ${DEPENDENCY_DIR}/git-%/Makefile: ${DEPENDENCY_DIR}/git-%.version ${Q}${GIT} -C "${@D}" fetch --depth 1 ${GIT_QUIET} origin ${GIT_VERSION} ${Q}${GIT} -C "${@D}" reset --hard ${Q}${GIT} -C "${@D}" checkout ${GIT_QUIET} --detach FETCH_HEAD +ifdef SKIP_OVERRIDING_GIT_VERSION + ${Q}rm -f "${@D}"/version +else @ # We're writing the version into the "version" file in Git's own source @ # directory. If it exists, Git's Makefile will pick it up and use it as @ # the version instead of auto-detecting via git-describe(1). ${Q}echo ${GIT_VERSION} >"${@D}"/version +endif ${Q}touch $@ $(patsubst %,${DEPENDENCY_DIR}/git-\%/%,${GIT_EXECUTABLES}): ${DEPENDENCY_DIR}/git-%/Makefile |