summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2017-11-21 12:37:07 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2017-11-28 00:36:48 +0100
commitb7ed102ea601fb4c6f65c5a982058f8c92883d31 (patch)
tree2992a0e51f697e00008a7832e3dc1bb8e6ae5599 /lib/api
parent8d3e80692cbeea06dd28a052554f0c262004e18d (diff)
downloadgitlab-ce-b7ed102ea601fb4c6f65c5a982058f8c92883d31.tar.gz
Allow filtering by 'status'
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/runners.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index b92a2c36cf3..18f9f142580 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -90,13 +90,20 @@ module API
end
params do
requires :id, type: Integer, desc: 'The ID of the runner'
+ optional :status, type: String, desc: 'Status of job'
use :pagination
end
get ':id/jobs' do
runner = get_runner(params[:id])
authenticate_list_runners_jobs!(runner)
- present paginate(runner.builds.running), with: Entities::JobWithProject
+ jobs = runner.builds
+ if params[:status]
+ not_found!('Status') unless Ci::Build::AVAILABLE_STATUSES.include?(params[:status])
+ jobs = jobs.where(status: params[:status].to_sym)
+ end
+
+ present paginate(jobs), with: Entities::JobWithProject
end
end