Merge branch 'update-gitlab-shell-in-tests' into 'master'

Update the gitlab-shell version in the tmp/tests directory to the right version

Previously the gitlab-shell version would never be updated if the directory existed via the `gitlab🐚install` Rake task. This could lead to incompatibility issues or random errors.

See merge request !5646
This commit is contained in:
Robert Speicher 2016-08-03 19:17:36 +00:00
commit f7c360cad6
1 changed files with 8 additions and 2 deletions

View File

@ -5,7 +5,8 @@ namespace :gitlab do
warn_user_is_not_gitlab
default_version = Gitlab::Shell.version_required
args.with_defaults(tag: 'v' + default_version, repo: "https://gitlab.com/gitlab-org/gitlab-shell.git")
default_version_tag = 'v' + default_version
args.with_defaults(tag: default_version_tag, repo: "https://gitlab.com/gitlab-org/gitlab-shell.git")
user = Gitlab.config.gitlab.user
home_dir = Rails.env.test? ? Rails.root.join('tmp/tests') : Gitlab.config.gitlab.user_home
@ -15,7 +16,12 @@ namespace :gitlab do
target_dir = Gitlab.config.gitlab_shell.path
# Clone if needed
unless File.directory?(target_dir)
if File.directory?(target_dir)
Dir.chdir(target_dir) do
system(*%W(Gitlab.config.git.bin_path} fetch --tags --quiet))
system(*%W(Gitlab.config.git.bin_path} checkout --quiet #{default_version_tag}))
end
else
system(*%W(#{Gitlab.config.git.bin_path} clone -- #{args.repo} #{target_dir}))
end