diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-08 21:07:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-08 21:07:53 +0300 |
commit | a3487798aeff89daff78749e6d6f392d3ca23687 (patch) | |
tree | fe7695c195931ee803aa862fc2bf977853b18a87 /app/services | |
parent | c6c5dd8848b78528d7ad7f044a0c95be629d372e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/ci/pipeline_creation/cancel_redundant_pipelines_service.rb | 28 | ||||
-rw-r--r-- | app/services/merge_requests/merge_service.rb | 1 |
2 files changed, 6 insertions, 23 deletions
diff --git a/app/services/ci/pipeline_creation/cancel_redundant_pipelines_service.rb b/app/services/ci/pipeline_creation/cancel_redundant_pipelines_service.rb index 06cd3d71097..48c3e6490ae 100644 --- a/app/services/ci/pipeline_creation/cancel_redundant_pipelines_service.rb +++ b/app/services/ci/pipeline_creation/cancel_redundant_pipelines_service.rb @@ -17,10 +17,8 @@ module Ci return if pipeline.parent_pipeline? # skip if child pipeline return unless project.auto_cancel_pending_pipelines? - pipelines = move_service_to_async? ? parent_and_child_pipelines : all_auto_cancelable_pipelines - Gitlab::OptimisticLocking - .retry_lock(pipelines, name: 'cancel_pending_pipelines') do |cancelables| + .retry_lock(parent_and_child_pipelines, name: 'cancel_pending_pipelines') do |cancelables| cancelables.select(:id).each_batch(of: BATCH_SIZE) do |cancelables_batch| auto_cancel_interruptible_pipelines(cancelables_batch.ids) end @@ -31,15 +29,11 @@ module Ci attr_reader :pipeline, :project - def all_auto_cancelable_pipelines - same_ref_pipelines - .id_not_in(pipeline.id) - .ci_and_parent_sources - .alive_or_scheduled - end - def parent_auto_cancelable_pipelines - same_ref_pipelines + project.all_pipelines + .created_after(1.week.ago) + .for_ref(pipeline.ref) + .where_not_sha(project.commit(pipeline.ref).try(:id)) .where("created_at < ?", pipeline.created_at) .ci_sources end @@ -71,18 +65,6 @@ module Ci ) end end - - def same_ref_pipelines - project.all_pipelines - .created_after(1.week.ago) - .for_ref(pipeline.ref) - .where_not_sha(project.commit(pipeline.ref).try(:id)) - end - - def move_service_to_async? - Feature.enabled?(:move_cancel_pending_pipelines_to_async, project) - end - strong_memoize_attr :move_service_to_async? end end end diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb index 6b4f9dbe509..e6b0ffbf716 100644 --- a/app/services/merge_requests/merge_service.rb +++ b/app/services/merge_requests/merge_service.rb @@ -98,6 +98,7 @@ module MergeRequests commit_id ensure merge_request.update_and_mark_in_progress_merge_commit_sha(nil) + log_info("Merge request marked in progress") end def update_merge_sha_metadata(commit_id) |