diff options
author | Rémy Coutable <remy@rymai.me> | 2018-05-21 11:29:41 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-05-21 13:10:03 +0200 |
commit | 829d25b8cc15098f9339df3c02041cce29e845ba (patch) | |
tree | f647e19123831a679d698c0079358cf267ad08ac | |
parent | 7381a33f696ca74b86a21f0b66e87be92d2efcc1 (diff) | |
download | gitlab-ce-32493-db-seed_fu-should-use-an-env-variable-to-specify-the-repo-url-for-gitlab-test.tar.gz |
Allow to use alternative sources (dev.gitlab.org) for repos used in CI jobs32493-db-seed_fu-should-use-an-env-variable-to-specify-the-repo-url-for-gitlab-test
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r-- | .gitlab-ci.yml | 6 | ||||
-rw-r--r-- | lib/tasks/gitlab/gitaly.rake | 8 | ||||
-rw-r--r-- | spec/support/helpers/test_env.rb | 7 |
3 files changed, 16 insertions, 5 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 84d8e69b84e..35851fc70dd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -193,8 +193,8 @@ stages: script: # Manually clone gitlab-test and only seed this project in # db/fixtures/development/04_project.rb thanks to SIZE=1 below - - git clone https://gitlab.com/gitlab-org/gitlab-test.git - /home/git/repositories/gitlab-org/gitlab-test.git + - GITLAB_GIT_TEST_REPO_URL=$(echo $CI_PROJECT_URL | sed "s|$CI_PROJECT_PATH|$CI_PROJECT_NAMESPACE|")/gitlab-test.git + - git clone $GITLAB_GIT_TEST_REPO_URL /home/git/repositories/gitlab-org/gitlab-test.git - scripts/gitaly-test-spawn - force=yes SIZE=1 FIXTURE_PATH="db/fixtures/development" bundle exec rake gitlab:setup artifacts: @@ -235,7 +235,7 @@ stages: variables: SETUP_DB: "false" script: - - git fetch https://gitlab.com/gitlab-org/gitlab-ce.git v9.3.0 + - git fetch $CI_PROJECT_URL.git v9.3.0 - git checkout -f FETCH_HEAD - bundle install $BUNDLE_INSTALL_FLAGS - date diff --git a/lib/tasks/gitlab/gitaly.rake b/lib/tasks/gitlab/gitaly.rake index e9ca6404fe8..1d4a47c59ac 100644 --- a/lib/tasks/gitlab/gitaly.rake +++ b/lib/tasks/gitlab/gitaly.rake @@ -10,7 +10,13 @@ namespace :gitlab do abort %(Please specify the directory where you want to install gitaly:\n rake "gitlab:gitaly:install[/home/git/gitaly]") end - args.with_defaults(repo: 'https://gitlab.com/gitlab-org/gitaly.git') + default_repo_url = + if ENV.key?('ALTERNATIVE_SOURCES') # rubocop:disable Cop/LineBreakAroundConditionalBlock + 'https://dev.gitlab.org/gitlab/gitaly.git' + else + 'https://gitlab.com/gitlab-org/gitaly.git' + end + args.with_defaults(repo: default_repo_url) version = Gitlab::GitalyClient.expected_server_version diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb index 57aa07cf4fa..e4542ba4165 100644 --- a/spec/support/helpers/test_env.rb +++ b/spec/support/helpers/test_env.rb @@ -207,7 +207,12 @@ module TestEnv end def setup_repo(repo_path, repo_path_bare, repo_name, refs) - clone_url = "https://gitlab.com/gitlab-org/#{repo_name}.git" + clone_url = + if ENV.key?('ALTERNATIVE_SOURCES') + "https://dev.gitlab.org/gitlab/#{repo_name}.git" + else + "https://gitlab.com/gitlab-org/#{repo_name}.git" + end unless File.directory?(repo_path) system(*%W(#{Gitlab.config.git.bin_path} clone -q #{clone_url} #{repo_path})) |