diff options
author | Felipe Artur <felipefac@gmail.com> | 2017-03-18 01:14:27 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2017-05-08 17:24:55 +0300 |
commit | 4ae411ff40352ec21bd10f859b7f3f9f85a7aee6 (patch) | |
tree | c7f38b9bc9a9fb826cf88de15fb61054f5354cab /app/services/ci/create_pipeline_service.rb | |
parent | 11ff9fc6a9837cd5defa0325b5057a5a3d84634c (diff) |
Preloads head pipeline for each merge request
Diffstat (limited to 'app/services/ci/create_pipeline_service.rb')
-rw-r--r-- | app/services/ci/create_pipeline_service.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index ccdda08d885..26b744ae3c4 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,12 @@ module Ci origin_sha && origin_sha != Gitlab::Git::BLANK_SHA end + def update_merge_requests_head_pipeline + merge_requests = MergeRequest.where(source_branch: @pipeline.ref, source_project: @pipeline.project) + + merge_requests.update_all(head_pipeline_id: @pipeline.id) if merge_requests.any? + end + def error(message, save: false) pipeline.errors.add(:base, message) pipeline.drop if save |