2017-01-30 06:11:58 -05:00
|
|
|
module API
|
|
|
|
module V3
|
|
|
|
class Pipelines < Grape::API
|
|
|
|
include PaginationParams
|
|
|
|
|
|
|
|
before { authenticate! }
|
|
|
|
|
|
|
|
params do
|
|
|
|
requires :id, type: String, desc: 'The project ID'
|
|
|
|
end
|
2017-03-15 14:09:24 -04:00
|
|
|
resource :projects, requirements: { id: %r{[^/]+} } do
|
2017-01-30 06:11:58 -05:00
|
|
|
desc 'Get all Pipelines of the project' do
|
|
|
|
detail 'This feature was introduced in GitLab 8.11.'
|
|
|
|
success ::API::Entities::Pipeline
|
|
|
|
end
|
|
|
|
params do
|
|
|
|
use :pagination
|
|
|
|
optional :scope, type: String, values: %w(running branches tags),
|
|
|
|
desc: 'Either running, branches, or tags'
|
|
|
|
end
|
|
|
|
get ':id/pipelines' do
|
|
|
|
authorize! :read_pipeline, user_project
|
|
|
|
|
2017-03-08 03:24:20 -05:00
|
|
|
pipelines = PipelinesFinder.new(user_project, scope: params[:scope]).execute
|
2017-01-30 06:11:58 -05:00
|
|
|
present paginate(pipelines), with: ::API::Entities::Pipeline
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
helpers do
|
|
|
|
def pipeline
|
|
|
|
@pipeline ||= user_project.pipelines.find(params[:pipeline_id])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|