summaryrefslogtreecommitdiff
path: root/app/workers
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2017-03-24 16:54:22 +0100
committerJacob Vosmaer <jacob@gitlab.com>2017-03-29 14:48:04 +0200
commitc837da34391094b9d58763a67db5cfb706ca146f (patch)
treef8e37a66ab012b2a6ec0c40c18b7eb366b6b5c09 /app/workers
parentb46ac16cc89d649bf5fba9a36f1911a575b41e1f (diff)
downloadgitlab-ce-c837da34391094b9d58763a67db5cfb706ca146f.tar.gz
Helper method for storage path stripping
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/post_receive.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb
index 2cd87895c55..015a41b6e82 100644
--- a/app/workers/post_receive.rb
+++ b/app/workers/post_receive.rb
@@ -3,20 +3,16 @@ class PostReceive
include DedicatedSidekiqQueue
def perform(repo_path, identifier, changes)
- if repository_storage = Gitlab.config.repositories.storages.find { |p| repo_path.start_with?(p[1]['path'].to_s) }
- repo_path.gsub!(repository_storage[1]['path'].to_s, "")
- else
- log("Check gitlab.yml config for correct repositories.storages values. No repository storage path matches \"#{repo_path}\"")
- end
+ repo_relative_path = Gitlab::RepoPath.strip_storage_path(repo_path)
changes = Base64.decode64(changes) unless changes.include?(' ')
# Use Sidekiq.logger so arguments can be correlated with execution
# time and thread ID's.
Sidekiq.logger.info "changes: #{changes.inspect}" if ENV['SIDEKIQ_LOG_ARGUMENTS']
- post_received = Gitlab::GitPostReceive.new(repo_path, identifier, changes)
+ post_received = Gitlab::GitPostReceive.new(repo_relative_path, identifier, changes)
if post_received.project.nil?
- log("Triggered hook for non-existing project with full path \"#{repo_path}\"")
+ log("Triggered hook for non-existing project with full path \"#{repo_relative_path}\"")
return false
end
@@ -25,7 +21,7 @@ class PostReceive
elsif post_received.regular_project?
process_project_changes(post_received)
else
- log("Triggered hook for unidentifiable repository type with full path \"#{repo_path}\"")
+ log("Triggered hook for unidentifiable repository type with full path \"#{repo_relative_path}\"")
false
end
end