Commit 03ff8139 authored by Sean Carroll's avatar Sean Carroll

Cancel rendundant pipelines

parent e74c7bad
......@@ -15,7 +15,11 @@ module MergeTrains
validate!
pipeline_created = create_pipeline! if should_create_pipeline?
if should_create_pipeline?
cancel_pipeline_if_exist
pipeline_created = create_pipeline!
end
merge! if should_merge?
success(pipeline_created: pipeline_created.present?)
......@@ -60,6 +64,12 @@ module MergeTrains
pipeline_absent? || require_recreate? || stale_pipeline?
end
def cancel_pipeline_if_exist
return unless pipeline_for_merge_train
pipeline_for_merge_train.cancel_running
end
def create_pipeline!
result = MergeTrains::CreatePipelineService.new(merge_request.project, merge_user)
.execute(merge_request, previous_ref)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment