diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-03-28 11:55:35 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-04-04 06:32:59 +0300 |
commit | 57f114566ad2ebd8c7a5c33497740de47a1d3f8b (patch) | |
tree | af0841456747b081a95a14c246fc7ab9741e53f0 /app/services/merge_requests/base_service.rb | |
parent | 74ace2a445a44a13bd22c1907b8ec55b1772d403 (diff) |
Backport attached merge request pipelines
Backport changes to CE
Diffstat (limited to 'app/services/merge_requests/base_service.rb')
-rw-r--r-- | app/services/merge_requests/base_service.rb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb index 3e208241da5..f968e3693da 100644 --- a/app/services/merge_requests/base_service.rb +++ b/app/services/merge_requests/base_service.rb @@ -55,15 +55,7 @@ module MergeRequests end def create_pipeline_for(merge_request, user) - return unless Feature.enabled?(:ci_merge_request_pipeline, - merge_request.source_project, - default_enabled: true) - - ## - # UpdateMergeRequestsWorker could be retried by an exception. - # MR pipelines should not be recreated in such case. - return if merge_request.merge_request_pipeline_exists? - return if merge_request.has_no_commits? + return unless can_create_pipeline_for?(merge_request) create_detached_merge_request_pipeline(merge_request, user) end @@ -80,6 +72,16 @@ module MergeRequests end end + def can_create_pipeline_for?(merge_request) + ## + # UpdateMergeRequestsWorker could be retried by an exception. + # pipelines for merge request should not be recreated in such case. + return false if merge_request.merge_request_pipeline_exists? + return false if merge_request.has_no_commits? + + true + end + def can_use_merge_request_ref?(merge_request) Feature.enabled?(:ci_use_merge_request_ref, project, default_enabled: true) && !merge_request.for_fork? |