Commit 1107e122 authored by Albert Salim's avatar Albert Salim

Merge branch 'remove-gitaly-build-dir-after-compiling-it' into 'master'

ci: Only keep relevant files after installing tests dependencies

See merge request gitlab-org/gitlab!49014
parents e5881df4 8540ffeb
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
# SEED_NESTED_GROUPS: "false" # requires network connection # SEED_NESTED_GROUPS: "false" # requires network connection
.run-dev-fixtures-script: &run-dev-fixtures-script .run-dev-fixtures-script: &run-dev-fixtures-script
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn" - run_timed_command "scripts/gitaly-test-spawn"
- run_timed_command "RAILS_ENV=test bundle exec rake db:seed_fu" - run_timed_command "RAILS_ENV=test bundle exec rake db:seed_fu"
......
...@@ -103,7 +103,6 @@ update-yarn-cache: ...@@ -103,7 +103,6 @@ update-yarn-cache:
WEBPACK_VENDOR_DLL: "true" WEBPACK_VENDOR_DLL: "true"
script: script:
- run_timed_command "gem install knapsack --no-document" - run_timed_command "gem install knapsack --no-document"
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn" - run_timed_command "scripts/gitaly-test-spawn"
- source ./scripts/rspec_helpers.sh - source ./scripts/rspec_helpers.sh
- rspec_paralellized_job "--tag frontend_fixture" - rspec_paralellized_job "--tag frontend_fixture"
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
# Only install knapsack after bundle install! Otherwise oddly some native # Only install knapsack after bundle install! Otherwise oddly some native
# gems could not be found under some circumstance. No idea why, hours wasted. # gems could not be found under some circumstance. No idea why, hours wasted.
- run_timed_command "gem install knapsack --no-document" - run_timed_command "gem install knapsack --no-document"
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn" - run_timed_command "scripts/gitaly-test-spawn"
- source ./scripts/rspec_helpers.sh - source ./scripts/rspec_helpers.sh
...@@ -150,20 +149,35 @@ setup-test-env: ...@@ -150,20 +149,35 @@ setup-test-env:
script: script:
- run_timed_command "bundle exec ruby -I. -e 'require \"config/environment\"; TestEnv.init'" - run_timed_command "bundle exec ruby -I. -e 'require \"config/environment\"; TestEnv.init'"
- run_timed_command "scripts/gitaly-test-build" # Do not use 'bundle exec' here - run_timed_command "scripts/gitaly-test-build" # Do not use 'bundle exec' here
- rm tmp/tests/gitaly/.ruby-bundle # This file prevents gems from being installed even if vendor/gitaly-ruby is missing
artifacts: artifacts:
expire_in: 7d expire_in: 7d
paths: paths:
- config/secrets.yml - config/secrets.yml
- tmp/tests/gitaly - tmp/tests/gitaly/config.toml
- tmp/tests/gitlab-elasticsearch-indexer - tmp/tests/gitaly/gitaly
- tmp/tests/gitlab-shell - tmp/tests/gitaly/gitaly2.config.toml
- tmp/tests/gitlab-test-fork - tmp/tests/gitaly/gitaly-git2go
- tmp/tests/gitlab-test-fork_bare - tmp/tests/gitaly/gitaly-hooks
- tmp/tests/gitlab-test - tmp/tests/gitaly/gitaly-lfs-smudge
- tmp/tests/gitlab-workhorse - tmp/tests/gitaly/gitaly-ssh
- tmp/tests/repositories - tmp/tests/gitaly/internal/
- tmp/tests/second_storage - tmp/tests/gitaly/internal_sockets/
- tmp/tests/gitaly/Makefile
- tmp/tests/gitaly/praefect
- tmp/tests/gitaly/praefect.config.toml
- tmp/tests/gitaly/ruby/
- tmp/tests/gitlab-elasticsearch-indexer/bin/gitlab-elasticsearch-indexer
- tmp/tests/gitlab-shell/
- tmp/tests/gitlab-test-fork/
- tmp/tests/gitlab-test-fork_bare/
- tmp/tests/gitlab-test/
- tmp/tests/gitlab-workhorse/gitlab-zip-metadata
- tmp/tests/gitlab-workhorse/gitlab-zip-cat
- tmp/tests/gitlab-workhorse/gitlab-workhorse
- tmp/tests/gitlab-workhorse/gitlab-resize-image
- tmp/tests/gitlab-workhorse/config.toml
- tmp/tests/repositories/
- tmp/tests/second_storage/
when: always when: always
update-rails-cache: update-rails-cache:
......
...@@ -504,6 +504,10 @@ request, be sure to start the `dont-interrupt-me` job before pushing. ...@@ -504,6 +504,10 @@ request, be sure to start the `dont-interrupt-me` job before pushing.
- `update-yarn-cache`, defined in [`.gitlab/ci/frontend.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/frontend.gitlab-ci.yml). - `update-yarn-cache`, defined in [`.gitlab/ci/frontend.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab/ci/frontend.gitlab-ci.yml).
1. These jobs run in merge requests whose title include `UPDATE CACHE`. 1. These jobs run in merge requests whose title include `UPDATE CACHE`.
### Artifacts strategy
We limit the artifacts that are saved and retrieved by jobs to the minimum in order to reduce the upload/download time and costs, as well as the artifacts storage.
### Pre-clone step ### Pre-clone step
The `gitlab-org/gitlab` project on GitLab.com uses a [pre-clone step](https://gitlab.com/gitlab-org/gitlab/-/issues/39134) The `gitlab-org/gitlab` project on GitLab.com uses a [pre-clone step](https://gitlab.com/gitlab-org/gitlab/-/issues/39134)
......
...@@ -12,7 +12,7 @@ class GitalyTestBuild ...@@ -12,7 +12,7 @@ class GitalyTestBuild
include GitalyTest include GitalyTest
def run def run
abort 'gitaly build failed' unless system(env, 'make', chdir: tmp_tests_gitaly_dir) abort 'gitaly build failed' unless build_gitaly
ensure_gitlab_shell_secret! ensure_gitlab_shell_secret!
check_gitaly_config! check_gitaly_config!
......
...@@ -8,6 +8,7 @@ class GitalyTestSpawn ...@@ -8,6 +8,7 @@ class GitalyTestSpawn
include GitalyTest include GitalyTest
def run def run
install_gitaly_gems if ENV['CI']
check_gitaly_config! check_gitaly_config!
# # Uncomment line below to see all gitaly logs merged into CI trace # # Uncomment line below to see all gitaly logs merged into CI trace
......
...@@ -41,7 +41,7 @@ module GitalyTest ...@@ -41,7 +41,7 @@ module GitalyTest
'HOME' => File.expand_path('tmp/tests'), 'HOME' => File.expand_path('tmp/tests'),
'GEM_PATH' => Gem.path.join(':'), 'GEM_PATH' => Gem.path.join(':'),
'BUNDLE_APP_CONFIG' => File.join(File.dirname(gemfile), '.bundle/config'), 'BUNDLE_APP_CONFIG' => File.join(File.dirname(gemfile), '.bundle/config'),
'BUNDLE_FLAGS' => "--jobs=4 --retry=3 --quiet", 'BUNDLE_FLAGS' => "--jobs=4 --retry=3",
'BUNDLE_INSTALL_FLAGS' => nil, 'BUNDLE_INSTALL_FLAGS' => nil,
'BUNDLE_GEMFILE' => gemfile, 'BUNDLE_GEMFILE' => gemfile,
'RUBYOPT' => nil, 'RUBYOPT' => nil,
...@@ -78,6 +78,14 @@ module GitalyTest ...@@ -78,6 +78,14 @@ module GitalyTest
end end
end end
def install_gitaly_gems
system(env, "make #{tmp_tests_gitaly_dir}/.ruby-bundle", chdir: tmp_tests_gitaly_dir) # rubocop:disable GitlabSecurity/SystemCommandInjection
end
def build_gitaly
system(env, 'make', chdir: tmp_tests_gitaly_dir) # rubocop:disable GitlabSecurity/SystemCommandInjection
end
def start_gitaly def start_gitaly
start(:gitaly) start(:gitaly)
end end
......
...@@ -33,7 +33,7 @@ Capybara.register_server :puma_via_workhorse do |app, port, host, **options| ...@@ -33,7 +33,7 @@ Capybara.register_server :puma_via_workhorse do |app, port, host, **options|
socket_path = file.path socket_path = file.path
file.close! # We just want the filename file.close! # We just want the filename
TestEnv.with_workhorse(TestEnv.workhorse_dir, host, port, socket_path) do TestEnv.with_workhorse(host, port, socket_path) do
Capybara.servers[:puma].call(app, nil, socket_path, **options) Capybara.servers[:puma].call(app, nil, socket_path, **options)
end end
end end
......
...@@ -284,7 +284,7 @@ module TestEnv ...@@ -284,7 +284,7 @@ module TestEnv
@workhorse_path ||= File.join('tmp', 'tests', 'gitlab-workhorse') @workhorse_path ||= File.join('tmp', 'tests', 'gitlab-workhorse')
end end
def with_workhorse(workhorse_dir, host, port, upstream, &blk) def with_workhorse(host, port, upstream, &blk)
host = "[#{host}]" if host.include?(':') host = "[#{host}]" if host.include?(':')
listen_addr = [host, port].join(':') listen_addr = [host, port].join(':')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment