summaryrefslogtreecommitdiff
path: root/app/services/git/base_hooks_service.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-22 11:31:16 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-22 11:31:16 +0000
commit905c1110b08f93a19661cf42a276c7ea90d0a0ff (patch)
tree756d138db422392c00471ab06acdff92c5a9b69c /app/services/git/base_hooks_service.rb
parent50d93f8d1686950fc58dda4823c4835fd0d8c14b (diff)
downloadgitlab-ce-905c1110b08f93a19661cf42a276c7ea90d0a0ff.tar.gz
Add latest changes from gitlab-org/gitlab@12-4-stable-ee
Diffstat (limited to 'app/services/git/base_hooks_service.rb')
-rw-r--r--app/services/git/base_hooks_service.rb28
1 files changed, 12 insertions, 16 deletions
diff --git a/app/services/git/base_hooks_service.rb b/app/services/git/base_hooks_service.rb
index 35a4d2015fa..0801fd4d03f 100644
--- a/app/services/git/base_hooks_service.rb
+++ b/app/services/git/base_hooks_service.rb
@@ -3,6 +3,7 @@
module Git
class BaseHooksService < ::BaseService
include Gitlab::Utils::StrongMemoize
+ include ChangeParams
# The N most recent commits to process in a single push payload.
PROCESS_COMMIT_LIMIT = 100
@@ -15,8 +16,6 @@ module Git
# Not a hook, but it needs access to the list of changed commits
enqueue_invalidate_cache
- update_remote_mirrors
-
success
end
@@ -49,6 +48,8 @@ module Git
# Push events in the activity feed only show information for the
# last commit.
def create_events
+ return unless params.fetch(:create_push_event, true)
+
EventCreateService.new.push(project, current_user, event_push_data)
end
@@ -63,6 +64,8 @@ module Git
end
def execute_project_hooks
+ return unless params.fetch(:execute_project_hooks, true)
+
# Creating push_data invokes one CommitDelta RPC per commit. Only
# build this data if we actually need it.
project.execute_hooks(push_data, hook_name) if project.has_active_hooks?(hook_name)
@@ -79,20 +82,20 @@ module Git
def pipeline_params
{
- before: params[:oldrev],
- after: params[:newrev],
- ref: params[:ref],
+ before: oldrev,
+ after: newrev,
+ ref: ref,
push_options: params[:push_options] || {},
checkout_sha: Gitlab::DataBuilder::Push.checkout_sha(
- project.repository, params[:newrev], params[:ref])
+ project.repository, newrev, ref)
}
end
def push_data_params(commits:, with_changed_files: true)
{
- oldrev: params[:oldrev],
- newrev: params[:newrev],
- ref: params[:ref],
+ oldrev: oldrev,
+ newrev: newrev,
+ ref: ref,
project: project,
user: current_user,
commits: commits,
@@ -121,13 +124,6 @@ module Git
{}
end
- def update_remote_mirrors
- return unless project.has_remote_mirror?
-
- project.mark_stuck_remote_mirrors_as_failed!
- project.update_remote_mirrors
- end
-
def log_pipeline_errors(exception)
data = {
class: self.class.name,