Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions bin/check
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,27 @@ resp = GitlabNet.new.check
if resp.code == "200"
print 'OK'
else
puts "FAILED. code: #{resp.code}"
abort "FAILED. code: #{resp.code}"
end

puts "\nCheck directories and files: "

config = GitlabConfig.new
dirs = [config.repos_path, config.auth_file, config.redis['bin']]
dirs = [config.repos_path, config.auth_file]

dirs.each do |dir|
abort("ERROR: missing option in config.yml") unless dir
print "\t#{dir}: "
if File.exists?(dir)
print 'OK'
else
puts "FAILED"
abort "FAILED"
end
puts "\n"
end

print "Test redis-cli executable: "
abort('FAILED') unless system(*config.redis_command, '--version')

print "Send ping to redis server: "
abort unless system(*config.redis_command, 'ping')
7 changes: 5 additions & 2 deletions lib/gitlab_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def exec
update_redis
exit 0
else
puts "GitLab: You are not allowed to access #{@branch_name}! "
puts "GitLab: You are not allowed to access #{@branch_name}!"
exit 1
end
else
Expand All @@ -56,6 +56,9 @@ def ssh?
def update_redis
queue = "#{config.redis_namespace}:queue:post_receive"
msg = JSON.dump({'class' => 'PostReceive', 'args' => [@repo_path, @oldrev, @newrev, @refname, @key_id]})
system(*config.redis_command, 'rpush', queue, msg, err: '/dev/null', out: '/dev/null')
unless system(*config.redis_command, 'rpush', queue, msg, err: '/dev/null', out: '/dev/null')
puts "GitLab: An unexpected error occurred (redis-cli returned #{$?.exitstatus})."
exit 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would write unless system(...) here.

@randx what do you think about aborting the git push when the Redis rpush fails? Considering this should rarely fail it might be good to have a hard failure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jacobvosmaer sounds like a good idea

end
end
end