diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-05-09 18:16:31 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-05-09 18:16:31 +0300 |
commit | a3607aa43971d03b718e070db271104553eca549 (patch) | |
tree | 5c08f9b44e263c2878cba496e088b04a93816788 /app/services | |
parent | a325a50a0369b036164a52b5449dc696ca75fdd9 (diff) | |
parent | 2ccee7161a58ea04c66b216ccb57e522850f5d95 (diff) |
Merge branch 'issue_27168_2' into 'master'
Preloads head pipeline for each merge request
Closes #27168
See merge request !10064
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/ci/create_pipeline_service.rb | 7 |
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 |