Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
f39959d0
Commit
f39959d0
authored
Dec 28, 2015
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some fixes to builds API
parent
b5fef34f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
20 deletions
+27
-20
lib/api/builds.rb
lib/api/builds.rb
+9
-18
lib/api/entities.rb
lib/api/entities.rb
+18
-2
No files found.
lib/api/builds.rb
View file @
f39959d0
...
...
@@ -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
...
...
lib/api/entities.rb
View file @
f39959d0
...
...
@@ -367,14 +367,30 @@ module API
expose
:id
,
:variables
end
class
CiCommit
<
Grape
::
Entity
expose
:id
expose
:ref
expose
:sha
expose
:committed_at
end
class
CiRunner
<
Grape
::
Entity
expose
:id
expose
:token
expose
:description
expose
:active
expose
:is_shared
expose
:name
end
class
Build
<
Grape
::
Entity
expose
:id
expose
:status
expose
:stage
expose
:name
expose
:ref
expose
:commit
expose
:runner
expose
:commit
,
with:
CiCommit
expose
:runner
,
with:
CiRunner
expose
:created_at
expose
:started_at
expose
:finished_at
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment