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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
2fe8ebc1
Commit
2fe8ebc1
authored
Jul 20, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
We need INNER JOIN to get the right pipeline,
also added a test for checking this.
parent
3925436a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
app/models/project.rb
app/models/project.rb
+1
-1
spec/requests/api/builds_spec.rb
spec/requests/api/builds_spec.rb
+7
-4
No files found.
app/models/project.rb
View file @
2fe8ebc1
...
...
@@ -431,7 +431,7 @@ class Project < ActiveRecord::Base
# ref can't be HEAD, can only be branch/tag name or SHA
def
latest_successful_builds_for
(
ref
=
default_branch
)
builds
.
where
(
pipeline:
pipelines
.
latest_successful_for
(
ref
)).
Ci
::
Build
.
joins
(
:pipeline
).
merge
(
pipelines
.
latest_successful_for
(
ref
)).
latest_successful_with_artifacts
end
...
...
spec/requests/api/builds_spec.rb
View file @
2fe8ebc1
...
...
@@ -256,14 +256,17 @@ describe API::API, api: true do
context
'with latest pipeline'
do
before
do
pipelines
=
Array
.
new
(
3
).
map
do
# creating some old pipelines
old_
pipelines
=
Array
.
new
(
3
).
map
do
# creating some old pipelines
create
(
:ci_pipeline
,
status:
'success'
)
end
pipelines
.
reverse_each
do
|
pipe
|
new
_build
=
create
(
:ci_build
,
:success
,
pipeline:
pipe
)
new
_build
.
update
(
artifacts_file:
another_artifacts
)
old_
pipelines
.
reverse_each
do
|
pipe
|
old
_build
=
create
(
:ci_build
,
:success
,
pipeline:
pipe
)
old
_build
.
update
(
artifacts_file:
another_artifacts
)
end
wrong_build
=
create
(
:ci_build
,
:success
,
pipeline:
pipeline
)
wrong_build
.
update
(
artifacts_file:
another_artifacts
)
end
before
do
...
...
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