diff --git a/Makefile b/Makefile index 8706ec734c19313757fc82a3668de26ad66e1f3c..7eb9167c0413bb42dbdb07c0a6c5f5a8455aabe1 100644 --- a/Makefile +++ b/Makefile @@ -161,6 +161,7 @@ GIT_VERSION_PREV ?= e4ef0485fd78fcb05866ea78df35796b904e4a8e # GIT_VERSION_x_xx defines versions for each instance of bundled Git we ship. When a new # major version is added, be sure to update GIT_PACKED_EXECUTABLES, the *-bundled-git targets, # and add new targets under the "# These targets build specific releases of Git." section. +GIT_VERSION_2_49 ?= v2.49.0.gl2 GIT_VERSION_2_50 ?= v2.50.1.gl1 # # OVERRIDE_GIT_VERSION allows you to specify a custom semver value to be reported by the @@ -172,7 +173,7 @@ OVERRIDE_GIT_VERSION ?= ${GIT_VERSION} ifeq (${GIT_VERSION:default=},) # GIT_VERSION should be overridden to the default version of bundled Git. This is only # necessary until https://gitlab.com/gitlab-org/gitaly/-/issues/6195 is complete. - override GIT_VERSION := ${GIT_VERSION_2_50} + override GIT_VERSION := ${GIT_VERSION_2_49} # When GIT_VERSION is not explicitly set, we default to bundled Git. export WITH_BUNDLED_GIT = YesPlease else @@ -274,7 +275,8 @@ ifdef CI endif # Git binaries that are eventually embedded into the Gitaly binary. -GIT_PACKED_EXECUTABLES = $(addprefix ${BUILD_DIR}/bin/gitaly-, $(addsuffix -v2.50, ${GIT_EXECUTABLES})) +GIT_PACKED_EXECUTABLES = $(addprefix ${BUILD_DIR}/bin/gitaly-, $(addsuffix -v2.49, ${GIT_EXECUTABLES})) \ + $(addprefix ${BUILD_DIR}/bin/gitaly-, $(addsuffix -v2.50, ${GIT_EXECUTABLES})) # All executables provided by Gitaly. GITALY_EXECUTABLES = $(addprefix ${BUILD_DIR}/bin/,$(notdir $(shell find ${SOURCE_DIR}/cmd -mindepth 1 -maxdepth 1 -type d -print))) @@ -363,13 +365,15 @@ install: build .PHONY: build-bundled-git ## Build bundled Git binaries. -build-bundled-git: build-bundled-git-v2.50 +build-bundled-git: build-bundled-git-v2.49 build-bundled-git-v2.50 +build-bundled-git-v2.49: $(patsubst %,${BUILD_DIR}/bin/gitaly-%-v2.49,${GIT_EXECUTABLES}) build-bundled-git-v2.50: $(patsubst %,${BUILD_DIR}/bin/gitaly-%-v2.50,${GIT_EXECUTABLES}) .PHONY: install-bundled-git ## Install bundled Git binaries. The target directory can be modified by ## setting PREFIX and DESTDIR. -install-bundled-git: install-bundled-git-v2.50 +install-bundled-git: install-bundled-git-v2.49 install-bundled-git-v2.50 +install-bundled-git-v2.49: $(patsubst %,${INSTALL_DEST_DIR}/gitaly-%-v2.49,${GIT_EXECUTABLES}) install-bundled-git-v2.50: $(patsubst %,${INSTALL_DEST_DIR}/gitaly-%-v2.50,${GIT_EXECUTABLES}) ifdef WITH_BUNDLED_GIT @@ -691,12 +695,17 @@ ${DEPENDENCY_DIR}/git-distribution/build/git: ${DEPENDENCY_DIR}/git-distribution ${Q}touch $@ # These targets build specific releases of Git. +${BUILD_DIR}/bin/gitaly-%-v2.49: override GIT_VERSION = ${GIT_VERSION_2_49} ${BUILD_DIR}/bin/gitaly-%-v2.50: override GIT_VERSION = ${GIT_VERSION_2_50} ifdef USE_MESON +${BUILD_DIR}/bin/gitaly-%-v2.49: ${DEPENDENCY_DIR}/git-v2.49/build/% | ${BUILD_DIR}/bin + ${Q}install $< $@ ${BUILD_DIR}/bin/gitaly-%-v2.50: ${DEPENDENCY_DIR}/git-v2.50/build/% | ${BUILD_DIR}/bin ${Q}install $< $@ else +${BUILD_DIR}/bin/gitaly-%-v2.49: ${DEPENDENCY_DIR}/git-v2.49/% | ${BUILD_DIR}/bin + ${Q}install $< $@ ${BUILD_DIR}/bin/gitaly-%-v2.50: ${DEPENDENCY_DIR}/git-v2.50/% | ${BUILD_DIR}/bin ${Q}install $< $@ endif diff --git a/internal/featureflag/ff_git_v250.go b/internal/featureflag/ff_git_v250.go new file mode 100644 index 0000000000000000000000000000000000000000..d9104944dad8c896e87ec2df0ea348f977b7fd3d --- /dev/null +++ b/internal/featureflag/ff_git_v250.go @@ -0,0 +1,9 @@ +package featureflag + +// GitV250 enables the use Git v2.50. +var GitV250 = NewFeatureFlag( + "git_v250", + "v18.2.0", + "https://gitlab.com/gitlab-org/gitaly/-/issues/6827", + true, +) diff --git a/internal/git/gitcmd/execution_environment.go b/internal/git/gitcmd/execution_environment.go index ac6640cd7eb2238883187c5a5a6f2a3718b414f4..560a172ac2c4d7cef19c078546f9eaeb439fadd7 100644 --- a/internal/git/gitcmd/execution_environment.go +++ b/internal/git/gitcmd/execution_environment.go @@ -23,6 +23,12 @@ var ( BundledGitConstructors = []BundledGitEnvironmentConstructor{ { Suffix: "-v2.50", + FeatureFlags: []featureflag.FeatureFlag{ + featureflag.GitV250, + }, + }, + { + Suffix: "-v2.49", }, } diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go index eb15352daf8910ed59b34f287a0fe6c4bab4175a..c9d2bf1bef44b4af51ad8f563d5cb7cae957fa46 100644 --- a/internal/testhelper/testhelper.go +++ b/internal/testhelper/testhelper.go @@ -326,6 +326,9 @@ func ContextWithoutCancel(opts ...ContextOpt) context.Context { newRepoReftableEnabled := env.GetString("GIT_DEFAULT_REF_FORMAT", "files") ctx = featureflag.ContextWithFeatureFlag(ctx, featureflag.NewRepoReftableBackend, newRepoReftableEnabled == "reftable") + // Randomly enable either Git version 2.49 or 2.50. + ctx = featureflag.ContextWithFeatureFlag(ctx, featureflag.GitV250, rnd.Int()%2 == 0) + // Enable snapshot filter ctx = featureflag.ContextWithFeatureFlag(ctx, featureflag.SnapshotFilter, true)