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
Jérome Perrin
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
Show 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
...
@@ -15,23 +15,15 @@ module API
# GET /projects/:id/builds
# GET /projects/:id/builds
get
':id/builds'
do
get
':id/builds'
do
all_builds
=
user_project
.
builds
all_builds
=
user_project
.
builds
builds
=
all_builds
.
order
(
'
created_at
DESC'
)
builds
=
all_builds
.
order
(
'
id
DESC'
)
builds
=
builds
=
case
params
[
:scope
]
case
params
[
:scope
]
when
'all'
builds
when
'finished'
when
'finished'
builds
.
finished
builds
.
finished
when
'running'
when
'running'
builds
.
running
builds
.
running
when
'pending'
builds
.
pending
when
'success'
builds
.
success
when
'failed'
builds
.
failed
else
else
builds
.
running_or_pending
.
reverse_order
builds
end
end
page
=
(
params
[
:page
]
||
1
).
to_i
page
=
(
params
[
:page
]
||
1
).
to_i
...
@@ -59,15 +51,14 @@ module API
...
@@ -59,15 +51,14 @@ module API
# Example Request:
# Example Request:
# GET /projects/:id/build/:build_id/trace
# GET /projects/:id/build/:build_id/trace
get
':id/builds/:build_id/trace'
do
get
':id/builds/:build_id/trace'
do
trace
=
get_build
(
params
[
:build_id
]).
trace
build
=
get_build
(
params
[
:build_id
])
trace
=
unless
trace
.
nil?
header
'Content-Disposition'
,
"infile; filename=
\"
#{
build
.
id
}
.log
\"
"
trace
.
split
(
"
\n
"
)
content_type
'text/plain'
else
env
[
'api.format'
]
=
:binary
[]
end
present
trace
trace
=
build
.
trace
body
trace
end
end
end
end
...
...
lib/api/entities.rb
View file @
f39959d0
...
@@ -367,14 +367,30 @@ module API
...
@@ -367,14 +367,30 @@ module API
expose
:id
,
:variables
expose
:id
,
:variables
end
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
class
Build
<
Grape
::
Entity
expose
:id
expose
:id
expose
:status
expose
:status
expose
:stage
expose
:stage
expose
:name
expose
:name
expose
:ref
expose
:ref
expose
:commit
expose
:commit
,
with:
CiCommit
expose
:runner
expose
:runner
,
with:
CiRunner
expose
:created_at
expose
:created_at
expose
:started_at
expose
:started_at
expose
:finished_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