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
d398e78e
Commit
d398e78e
authored
Dec 28, 2015
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add endpoint for getting builds for a specific commit
parent
f4cff4dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
12 deletions
+26
-12
lib/api/builds.rb
lib/api/builds.rb
+26
-12
No files found.
lib/api/builds.rb
View file @
d398e78e
...
...
@@ -4,7 +4,7 @@ module API
before
{
authenticate!
}
resource
:projects
do
# Get a project
repository commit
s
# Get a project
build
s
#
# Parameters:
# id (required) - The ID of a project
...
...
@@ -14,18 +14,21 @@ module API
# Example Request:
# GET /projects/:id/builds
get
':id/builds'
do
all_builds
=
user_project
.
builds
builds
=
all_builds
.
order
(
'id DESC'
)
builds
=
case
params
[
:scope
]
when
'finished'
builds
.
finished
when
'running'
builds
.
running
else
builds
end
builds
=
user_project
.
builds
.
order
(
'id DESC'
)
builds
=
filter_builds
(
builds
,
params
[
:scope
])
present
paginate
(
builds
),
with:
Entities
::
Build
end
# GET builds for a specific commit of a project
#
# Parameters:
# id (required) - The ID of a project
# sha (required) - The SHA id of a commit
# Example Request:
# GET /projects/:id/builds/commit/:sha
get
':id/builds/commit/:sha'
do
builds
=
user_project
.
ci_commits
.
find_by_sha
(
params
[
:sha
]).
builds
.
order
(
'id DESC'
)
builds
=
filter_builds
(
builds
,
params
[
:scope
])
present
paginate
(
builds
),
with:
Entities
::
Build
end
...
...
@@ -63,6 +66,17 @@ module API
def
get_build
(
id
)
user_project
.
builds
.
where
(
id:
id
).
first
end
def
filter_builds
(
builds
,
scope
)
case
scope
when
'finished'
builds
.
finished
when
'running'
builds
.
running
else
builds
end
end
end
end
end
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