summaryrefslogtreecommitdiff
path: root/app/services/ci/create_pipeline_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/ci/create_pipeline_service.rb')
-rw-r--r--app/services/ci/create_pipeline_service.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb
index ccdda08d885..1f6c1f4a7f6 100644
--- a/app/services/ci/create_pipeline_service.rb
+++ b/app/services/ci/create_pipeline_service.rb
@@ -47,7 +47,7 @@ module Ci
end
Ci::Pipeline.transaction do
- pipeline.save
+ update_merge_requests_head_pipeline if pipeline.save
Ci::CreatePipelineBuildsService
.new(project, current_user)
@@ -118,6 +118,11 @@ module Ci
origin_sha && origin_sha != Gitlab::Git::BLANK_SHA
end
+ def update_merge_requests_head_pipeline
+ MergeRequest.where(source_branch: @pipeline.ref, source_project: @pipeline.project).
+ update_all(head_pipeline_id: @pipeline.id)
+ end
+
def error(message, save: false)
pipeline.errors.add(:base, message)
pipeline.drop if save