diff options
author | Robert Speicher <robert@gitlab.com> | 2017-05-03 16:14:42 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-05-03 16:14:42 +0000 |
commit | 501cb18be38eca623f143721dd76871d86badf9c (patch) | |
tree | b160966761e912ed06cb5024bb8e97e61b8031e9 /lib | |
parent | 439d55031166929a3cc4035f128f9a7156594a85 (diff) | |
parent | 4fe7c25556c7343e46369ffc1e72db1346cc1360 (diff) | |
download | gitlab-ce-501cb18be38eca623f143721dd76871d86badf9c.tar.gz |
Merge branch '28408-feature-proposal-include-search-options-to-pipelines-api' into 'master'
Resolve "Feature Proposal: Include search options to pipelines API"
Closes #28408
See merge request !9367
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/pipelines.rb | 16 | ||||
-rw-r--r-- | lib/api/v3/pipelines.rb | 2 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/api/pipelines.rb b/lib/api/pipelines.rb index 754c3d85a04..9117704aa46 100644 --- a/lib/api/pipelines.rb +++ b/lib/api/pipelines.rb @@ -14,13 +14,23 @@ module API end params do use :pagination - optional :scope, type: String, values: %w(running branches tags), - desc: 'Either running, branches, or tags' + optional :scope, type: String, values: %w[running pending finished branches tags], + desc: 'The scope of pipelines' + optional :status, type: String, values: HasStatus::AVAILABLE_STATUSES, + desc: 'The status of pipelines' + optional :ref, type: String, desc: 'The ref of pipelines' + optional :yaml_errors, type: Boolean, desc: 'Returns pipelines with invalid configurations' + optional :name, type: String, desc: 'The name of the user who triggered pipelines' + optional :username, type: String, desc: 'The username of the user who triggered pipelines' + optional :order_by, type: String, values: PipelinesFinder::ALLOWED_INDEXED_COLUMNS, default: 'id', + desc: 'Order pipelines' + optional :sort, type: String, values: %w[asc desc], default: 'desc', + desc: 'Sort pipelines' end get ':id/pipelines' do authorize! :read_pipeline, user_project - pipelines = PipelinesFinder.new(user_project).execute(scope: params[:scope]) + pipelines = PipelinesFinder.new(user_project, params).execute present paginate(pipelines), with: Entities::PipelineBasic end diff --git a/lib/api/v3/pipelines.rb b/lib/api/v3/pipelines.rb index 82827249244..c48cbd2b765 100644 --- a/lib/api/v3/pipelines.rb +++ b/lib/api/v3/pipelines.rb @@ -21,7 +21,7 @@ module API get ':id/pipelines' do authorize! :read_pipeline, user_project - pipelines = PipelinesFinder.new(user_project).execute(scope: params[:scope]) + pipelines = PipelinesFinder.new(user_project, scope: params[:scope]).execute present paginate(pipelines), with: ::API::Entities::Pipeline end end |