diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-07-25 18:04:23 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-07-25 18:04:23 +0300 |
commit | ac948684fc9f4ded80a028ad2136cfbff90a4b45 (patch) | |
tree | fe4d625514c702b1b66c5575deefd1ce4d5bc0ba /lib/ci | |
parent | 3f59e354a7324e9bf332a34661743d85e82b987c (diff) | |
parent | 8a444484345806dcbc0312d770b185edde1edb67 (diff) |
Merge branch '30634-protected-pipeline' into 'master'
Implement "Block pipelines on protected branches"
Closes #30634, #34616, and #33130
See merge request !11910
Diffstat (limited to 'lib/ci')
-rw-r--r-- | lib/ci/api/triggers.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/ci/api/triggers.rb b/lib/ci/api/triggers.rb index 6e622601680..6225203f223 100644 --- a/lib/ci/api/triggers.rb +++ b/lib/ci/api/triggers.rb @@ -24,12 +24,13 @@ module Ci end # create request and trigger builds - trigger_request = Ci::CreateTriggerRequestService.new.execute(project, trigger, params[:ref], variables) - if trigger_request - present trigger_request, with: Entities::TriggerRequest + result = Ci::CreateTriggerRequestService.execute(project, trigger, params[:ref], variables) + pipeline = result.pipeline + + if pipeline.persisted? + present result.trigger_request, with: Entities::TriggerRequest else - errors = 'No builds created' - render_api_error!(errors, 400) + render_validation_error!(pipeline) end end end |