diff options
author | Ido Leibovich <ileibovich@yotpo.com> | 2016-10-31 23:38:24 +0300 |
---|---|---|
committer | Ido Leibovich <ileibovich@yotpo.com> | 2016-11-19 00:12:21 +0300 |
commit | fbfc7523cb0119ac3a0d02cd04dc12e453ad3ad6 (patch) | |
tree | 1b34fee3275f5e14eec71452628252384876c352 /lib/api/pipelines.rb | |
parent | 75c8faf7ba76563a175766495e132b2f6bdc95d4 (diff) |
Add api endpoint for creating a pipeline
Add a new endpoint in the new API for creating a new pipeline, and return the details of that pipeline.
Diffstat (limited to 'lib/api/pipelines.rb')
-rw-r--r-- | lib/api/pipelines.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/api/pipelines.rb b/lib/api/pipelines.rb index 2a0c8e1f2c0..e69b0569612 100644 --- a/lib/api/pipelines.rb +++ b/lib/api/pipelines.rb @@ -22,6 +22,27 @@ module API pipelines = PipelinesFinder.new(user_project).execute(scope: params[:scope]) present paginate(pipelines), with: Entities::Pipeline end + + desc 'Create a new pipeline' do + detail 'This feature was introduced in GitLab 8.14' + success Entities::Pipeline + end + params do + requires :ref, type: String, desc: 'Reference' + end + post ':id/pipeline' do + authorize! :create_pipeline, user_project + + new_pipeline = Ci::CreatePipelineService.new(user_project, + current_user, + declared_params(include_missing: false)) + .execute(ignore_skip_ci: true, save_on_errors: false) + if new_pipeline.persisted? + present new_pipeline, with: Entities::Pipeline + else + render_validation_error!(new_pipeline) + end + end desc 'Gets a specific pipeline for the project' do detail 'This feature was introduced in GitLab 8.11' |