diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2014-12-12 11:08:52 +0000 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2014-12-12 11:08:52 +0000 |
commit | b205db630074fe5c7be62d1f47fe9585703f8d57 (patch) | |
tree | f49918bf5c18c4d553e9b880b325c0820fd0f61b | |
parent | 9a3ae331adac6f4cc5ace771f740981811bdb41e (diff) | |
parent | e5951cf4aec15fc58730f88454d2b6d71ff25802 (diff) | |
download | gitlab-ce-b205db630074fe5c7be62d1f47fe9585703f8d57.tar.gz |
Merge branch 'fix_shell_commands_in_shell_install' into 'master'
Fix shell commands in shell install
Fixes #1610
See merge request !1320
-rw-r--r-- | lib/tasks/gitlab/shell.rake | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index 202e55c89ad..9af93300e08 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -17,15 +17,19 @@ namespace :gitlab do # Clone if needed unless File.directory?(target_dir) - sh(*%W(git clone #{args.repo} #{target_dir})) + system(*%W(git clone -- #{args.repo} #{target_dir})) end # Make sure we're on the right tag Dir.chdir(target_dir) do # 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}" + reseted = reset_to_commit(args) + + unless reseted + system(*%W(git fetch origin)) + reset_to_commit(args) + end config = { user: user, @@ -54,7 +58,7 @@ namespace :gitlab do File.open("config.yml", "w+") {|f| f.puts config.to_yaml} # Launch installation process - sh "bin/install" + system(*%W(bin/install)) end # Required for debian packaging with PKGR: Setup .ssh/environment with @@ -118,5 +122,16 @@ namespace :gitlab do puts "Quitting...".red exit 1 end + + def reset_to_commit(args) + tag, status = Gitlab::Popen.popen(%W(git describe -- #{args.tag})) + + unless status.zero? + tag, status = Gitlab::Popen.popen(%W(git describe -- origin/#{args.tag})) + end + + tag = tag.strip + system(*%W(git reset --hard #{tag})) + end end |