Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Fargher <proglottis@gmail.com>2022-03-29 05:40:04 +0300
committerJames Fargher <proglottis@gmail.com>2022-03-29 05:40:04 +0300
commitca8820bb03f012e8abfe7f5da0dfcd9eeb8003b9 (patch)
tree52a5022f85d25831788aba1d24e634c85b878516
parentcc42cf8f28dc37bf808dabaac8a055a84b83a5db (diff)
parent4cfd88ae0d5a02ec54f12367f84e5bb4d16c1569 (diff)
Merge branch 'pks-ci-bundled-git' into 'master'
ci: Convert jobs to test with bundled Git only by default See merge request gitlab-org/gitaly!4391
-rw-r--r--.gitlab-ci.yml37
-rw-r--r--Makefile5
-rwxr-xr-x_support/test-boot29
3 files changed, 39 insertions, 32 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 92bbe4302..be5db9a1a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -37,6 +37,7 @@ include:
cache: &cache_deps_configuration
key:
files:
+ - .gitlab-ci.yml
- Makefile
prefix: git-${GIT_VERSION}
paths:
@@ -48,6 +49,7 @@ include:
cache: &cache_gems_configuration
key:
files:
+ - .gitlab-ci.yml
- ruby/Gemfile.lock
prefix: debian-${DEBIAN_VERSION}-ruby-${RUBY_VERSION}
paths:
@@ -58,6 +60,7 @@ include:
cache: &cache_go_configuration
key:
files:
+ - .gitlab-ci.yml
- go.sum
prefix: go-${GO_VERSION}
paths:
@@ -108,16 +111,13 @@ build:
policy: pull-push
script:
- go version
- - make all git $(pwd)/_build/tools/protoc
- - _support/test-boot .
+ - make build $(pwd)/_build/tools/protoc $(test "${GIT_VERSION}" = "default" && echo "build-bundled-git" || echo "git")
+ - _support/test-boot . ${TEST_BOOT_ARGS}
parallel:
matrix:
- # These definitions are for the non-default Git versions.
- #- GO_VERSION: [ "1.16", "1.17" ]
- # GIT_VERSION: [ ]
- # These definitions are for the default Git version where we want to
- # apply our default set of Git patches.
- GO_VERSION: [ "1.16", "1.17" ]
+ TEST_BOOT_ARGS: "--bundled-git"
+ - GIT_VERSION: "v2.33.0"
build:binaries:
stage: build
@@ -144,30 +144,23 @@ build:binaries:
test:
<<: *test_definition
script:
- # If we're testing with bundled Git, then we don't want to have the Git
- # installation around. Otherwise, Git would be able to resolve its binaries
- # by just looking at its own GIT_PREFIX and then pick binaries from that
- # installation directory.
- - if test -n "${WITH_BUNDLED_GIT}"; then rm -rf _build/deps/git/install; fi
# We need to prepare test dependencies as privileged user.
- - make build prepare-tests
+ - make build prepare-tests $(test "${GIT_VERSION}" = default && echo WITH_BUNDLED_GIT=YesPlease)
# But the actual tests should run unprivileged. This assures that we pay
# proper attention to permission bits and that we don't modify the source
# directory.
- - setpriv --reuid=9999 --regid=9999 --clear-groups --no-new-privs env HOME=/dev/null make ${TARGET} SKIP_RSPEC_BUILD=YesPlease
+ - setpriv --reuid=9999 --regid=9999 --clear-groups --no-new-privs env HOME=/dev/null make ${TARGET} SKIP_RSPEC_BUILD=YesPlease $(test "${GIT_VERSION}" = default && echo WITH_BUNDLED_GIT=YesPlease)
parallel:
matrix:
- # These definitions are for the non-default Git versions.
- #- GO_VERSION: [ "1.16", "1.17" ]
- # GIT_VERSION: [ ]
- # TARGET: test
- # These definitions are for the default Git version where we want to
- # apply our default set of Git patches.
+ # The following jobs all test with our default Git version, which is
+ # using bundled Git binaries.
- GO_VERSION: [ "1.16", "1.17" ]
TARGET: test
- TARGET: [ test-with-proxies, test-with-praefect, race-go ]
- - WITH_BUNDLED_GIT: "with-bundled-git"
- TARGET: test
+ # We also verify that things work as expected with a non-bundled Git
+ # version matching our minimum required Git version.
+ - TARGET: test
+ GIT_VERSION: "v2.33.0"
# Execute tests with our minimum required Postgres version, as well. If
# the minimum version changes, please change this to the new minimum
# version. Furthermore, please make sure to update the minimum required
diff --git a/Makefile b/Makefile
index b6372e551..373efa3eb 100644
--- a/Makefile
+++ b/Makefile
@@ -375,10 +375,9 @@ install: install-bundled-git
export GITALY_TESTING_BUNDLED_GIT_PATH ?= ${BUILD_DIR}/bin
else
-prepare-tests: git build-bundled-git
+prepare-tests: git
-export GITALY_TESTING_BUNDLED_GIT_PATH ?= ${BUILD_DIR}/bin
-export GITALY_TESTING_GIT_BINARY ?= ${GIT_PREFIX}/bin/git
+export GITALY_TESTING_GIT_BINARY ?= ${GIT_PREFIX}/bin/git
endif
.PHONY: prepare-tests
diff --git a/_support/test-boot b/_support/test-boot
index 4a9be6709..67be87553 100755
--- a/_support/test-boot
+++ b/_support/test-boot
@@ -2,14 +2,21 @@
require 'tempfile'
require 'socket'
+require 'optparse'
ADDR = 'socket'.freeze
-def main(gitaly_dir)
- gitaly_dir = File.realpath(gitaly_dir)
+def main(params)
+ gitaly_dir = File.realpath(params[:dir])
build_dir = File.join(gitaly_dir, '_build')
bin_dir = File.join(build_dir, 'bin')
- git_path = File.join(build_dir, 'deps', 'git', 'install', 'bin', 'git')
+
+ git_path, use_bundled_git =
+ if params[:"bundled-git"]
+ ["", true]
+ else
+ [File.join(build_dir, 'deps', 'git', 'install', 'bin', 'git'), false]
+ end
version = IO.popen("#{File.join(bin_dir, 'gitaly')} -version").read.delete_prefix('Gitaly, version ').strip
version_from_file = IO.read(File.join(gitaly_dir, 'VERSION')).strip
@@ -35,6 +42,7 @@ def main(gitaly_dir)
path = "#{dir}"
[git]
+ use_bundled_binaries = #{use_bundled_git}
bin_path = "#{git_path}"
[gitaly-ruby]
@@ -85,8 +93,15 @@ def wait_connect
abort
end
-unless ARGV.count == 1
- abort "Usage: #{$PROGRAM_NAME} GITALY_DIR"
-end
+params = {}
+OptionParser.new do |parser|
+ parser.banner = "Usage: #{$PROGRAM_NAME} [options] <GITALY_DIR>"
+ parser.on('--[no-]bundled-git', 'Set up Gitaly with bundled Git binaries')
+end.parse!(into: params)
+
+params[:dir] = ARGV.pop
+abort "Gitaly source directory not provided" if params[:dir].nil?
+
+abort "Extra arguments" unless ARGV.count == 0
-main(ARGV.first)
+main(params)