Only clone GitLab Shell on tests if necessary.
This commit is contained in:
parent
b43e918a73
commit
065ab3e5f3
2 changed files with 10 additions and 5 deletions
|
@ -22,7 +22,10 @@ namespace :gitlab do
|
||||||
|
|
||||||
# Make sure we're on the right tag
|
# Make sure we're on the right tag
|
||||||
Dir.chdir(target_dir) do
|
Dir.chdir(target_dir) do
|
||||||
sh "git fetch origin && git reset --hard $(git describe #{args.tag} || git describe origin/#{args.tag})"
|
# First try to checkout without fetching
|
||||||
|
# to avoid stalling tests if the Internet is down.
|
||||||
|
reset = "git reset --hard $(git describe #{args.tag} || git describe origin/#{args.tag})"
|
||||||
|
sh "#{reset} || git fetch origin && #{reset}"
|
||||||
|
|
||||||
redis_url = URI.parse(ENV['REDIS_URL'] || "redis://localhost:6379")
|
redis_url = URI.parse(ENV['REDIS_URL'] || "redis://localhost:6379")
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,11 @@ module TestEnv
|
||||||
tmp_test_path = Rails.root.join('tmp', 'tests')
|
tmp_test_path = Rails.root.join('tmp', 'tests')
|
||||||
|
|
||||||
if File.directory?(tmp_test_path)
|
if File.directory?(tmp_test_path)
|
||||||
FileUtils.rm_r(tmp_test_path)
|
Dir.entries(tmp_test_path).each do |entry|
|
||||||
|
unless ['.', '..', 'gitlab-shell'].include?(entry)
|
||||||
|
FileUtils.rm_r(File.join(tmp_test_path, entry))
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
FileUtils.mkdir_p(tmp_test_path)
|
FileUtils.mkdir_p(tmp_test_path)
|
||||||
|
@ -38,9 +42,7 @@ module TestEnv
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_gitlab_shell
|
def setup_gitlab_shell
|
||||||
unless File.directory?(Gitlab.config.gitlab_shell.path)
|
`rake gitlab:shell:install`
|
||||||
%x[rake gitlab:shell:install]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_factory_repo
|
def setup_factory_repo
|
||||||
|
|
Loading…
Reference in a new issue