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
iv
gitlab-ce
Commits
8e666187
Commit
8e666187
authored
Jun 22, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Find all builds for commit if multiple pipelines
parent
2c3f3cb3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
lib/api/builds.rb
lib/api/builds.rb
+3
-3
spec/requests/api/builds_spec.rb
spec/requests/api/builds_spec.rb
+6
-2
No files found.
lib/api/builds.rb
View file @
8e666187
...
@@ -33,10 +33,10 @@ module API
...
@@ -33,10 +33,10 @@ module API
get
':id/repository/commits/:sha/builds'
do
get
':id/repository/commits/:sha/builds'
do
authorize_read_builds!
authorize_read_builds!
commit
=
user_project
.
pipelines
.
find_by_sha
(
params
[
:sha
])
pipelines
=
user_project
.
pipelines
.
where
(
sha:
params
[
:sha
])
return
not_found!
unless
commit
return
not_found!
if
pipelines
.
empty?
builds
=
commit
.
builds
.
order
(
'id DESC'
)
builds
=
user_project
.
builds
.
where
(
pipeline:
pipelines
)
.
order
(
'id DESC'
)
builds
=
filter_builds
(
builds
,
params
[
:scope
])
builds
=
filter_builds
(
builds
,
params
[
:scope
])
present
paginate
(
builds
),
with:
Entities
::
Build
,
present
paginate
(
builds
),
with:
Entities
::
Build
,
...
...
spec/requests/api/builds_spec.rb
View file @
8e666187
...
@@ -64,14 +64,18 @@ describe API::API, api: true do
...
@@ -64,14 +64,18 @@ describe API::API, api: true do
describe
'GET /projects/:id/repository/commits/:sha/builds'
do
describe
'GET /projects/:id/repository/commits/:sha/builds'
do
before
do
before
do
project
.
ensure_pipeline
(
pipeline
.
sha
,
'master'
)
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
pipeline
.
sha
}
/builds"
,
api_user
)
create
(
:ci_build
,
pipeline:
pipeline
)
create
(
:ci_build
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
commit
.
id
}
/builds"
,
api_user
)
end
end
context
'authorized user'
do
context
'authorized user'
do
it
'should return project builds for specific commit'
do
it
'should return project builds for specific commit'
do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
size
).
to
eq
2
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