summaryrefslogtreecommitdiff
path: root/lib/api/builds.rb
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2015-12-28 13:09:51 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2015-12-28 13:09:51 +0100
commitf39959d00a1358ba7d73ebeaccb827738c8151ba (patch)
tree999d36eed435e0a3b609fd0cb0f6dc77c1dd411d /lib/api/builds.rb
parentb5fef34f1e3beb60e7184cfb3420976bfa367137 (diff)
downloadgitlab-ce-f39959d00a1358ba7d73ebeaccb827738c8151ba.tar.gz
Add some fixes to builds API
Diffstat (limited to 'lib/api/builds.rb')
-rw-r--r--lib/api/builds.rb27
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/api/builds.rb b/lib/api/builds.rb
index 0ddb9e98de6..863be0d5e40 100644
--- a/lib/api/builds.rb
+++ b/lib/api/builds.rb
@@ -15,23 +15,15 @@ module API
# GET /projects/:id/builds
get ':id/builds' do
all_builds = user_project.builds
- builds = all_builds.order('created_at DESC')
+ builds = all_builds.order('id DESC')
builds =
case params[:scope]
- when 'all'
- builds
when 'finished'
builds.finished
when 'running'
builds.running
- when 'pending'
- builds.pending
- when 'success'
- builds.success
- when 'failed'
- builds.failed
else
- builds.running_or_pending.reverse_order
+ builds
end
page = (params[:page] || 1).to_i
@@ -59,15 +51,14 @@ module API
# Example Request:
# GET /projects/:id/build/:build_id/trace
get ':id/builds/:build_id/trace' do
- trace = get_build(params[:build_id]).trace
- trace =
- unless trace.nil?
- trace.split("\n")
- else
- []
- end
+ build = get_build(params[:build_id])
+
+ header 'Content-Disposition', "infile; filename=\"#{build.id}.log\""
+ content_type 'text/plain'
+ env['api.format'] = :binary
- present trace
+ trace = build.trace
+ body trace
end
end