diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /app/services/git | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'app/services/git')
-rw-r--r-- | app/services/git/base_hooks_service.rb | 5 | ||||
-rw-r--r-- | app/services/git/branch_hooks_service.rb | 7 | ||||
-rw-r--r-- | app/services/git/branch_push_service.rb | 2 | ||||
-rw-r--r-- | app/services/git/process_ref_changes_service.rb | 6 |
4 files changed, 13 insertions, 7 deletions
diff --git a/app/services/git/base_hooks_service.rb b/app/services/git/base_hooks_service.rb index 1eb54e13522..aee2f685e97 100644 --- a/app/services/git/base_hooks_service.rb +++ b/app/services/git/base_hooks_service.rb @@ -25,6 +25,7 @@ module Git raise NotImplementedError, "Please implement #{self.class}##{__method__}" end + # The changeset, ordered with the newest commit last def commits raise NotImplementedError, "Please implement #{self.class}##{__method__}" end @@ -132,10 +133,10 @@ module Git end def event_push_data - # We only need the last commit for the event push, and we don't + # We only need the newest commit for the event push, and we don't # need the full deltas either. @event_push_data ||= Gitlab::DataBuilder::Push.build( - **push_data_params(commits: commits.last, with_changed_files: false) + **push_data_params(commits: limited_commits.last, with_changed_files: false) ) end diff --git a/app/services/git/branch_hooks_service.rb b/app/services/git/branch_hooks_service.rb index a49b981c680..7a22d7ffcdf 100644 --- a/app/services/git/branch_hooks_service.rb +++ b/app/services/git/branch_hooks_service.rb @@ -21,8 +21,9 @@ module Git def commits strong_memoize(:commits) do if creating_default_branch? - # The most recent PROCESS_COMMIT_LIMIT commits in the default branch - project.repository.commits(newrev, limit: PROCESS_COMMIT_LIMIT) + # The most recent PROCESS_COMMIT_LIMIT commits in the default branch. + # They are returned newest-to-oldest, but we need to present them oldest-to-newest + project.repository.commits(newrev, limit: PROCESS_COMMIT_LIMIT).reverse elsif creating_branch? # Use the pushed commits that aren't reachable by the default branch # as a heuristic. This may include more commits than are actually @@ -95,7 +96,7 @@ module Git end def track_ci_config_change_event - return unless Gitlab::CurrentSettings.usage_ping_enabled? + return unless ::ServicePing::ServicePingSettings.enabled? return unless default_branch? commits_changing_ci_config.each do |commit| diff --git a/app/services/git/branch_push_service.rb b/app/services/git/branch_push_service.rb index 5dcc2de456c..5bf39d98fa3 100644 --- a/app/services/git/branch_push_service.rb +++ b/app/services/git/branch_push_service.rb @@ -58,7 +58,7 @@ module Git def stop_environments return unless removing_branch? - Ci::StopEnvironmentsService.new(project, current_user).execute(branch_name) + Environments::StopService.new(project, current_user).execute_for_branch(branch_name) end def unlock_artifacts diff --git a/app/services/git/process_ref_changes_service.rb b/app/services/git/process_ref_changes_service.rb index 6f348ff9e0b..da05f18b5ac 100644 --- a/app/services/git/process_ref_changes_service.rb +++ b/app/services/git/process_ref_changes_service.rb @@ -51,7 +51,7 @@ module Git change: change, push_options: params[:push_options], merge_request_branches: merge_request_branches, - create_pipelines: change[:index] < PIPELINE_PROCESS_LIMIT || Feature.enabled?(:git_push_create_all_pipelines, project), + create_pipelines: under_process_limit?(change), execute_project_hooks: execute_project_hooks, create_push_event: !create_bulk_push_event ).execute @@ -60,6 +60,10 @@ module Git create_bulk_push_event(ref_type, action, changes) if create_bulk_push_event end + def under_process_limit?(change) + change[:index] < PIPELINE_PROCESS_LIMIT || Feature.enabled?(:git_push_create_all_pipelines, project) + end + def create_bulk_push_event(ref_type, action, changes) EventCreateService.new.bulk_push( project, |