Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
ad8c54de51e1
Commit
2fe8ebc1
authored
Jul 20, 2016
by
Lin Jen-Shin
Browse files
We need INNER JOIN to get the right pipeline,
also added a test for checking this.
parent
b26584683c40
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/models/project.rb
View file @
ad8c54de
...
...
@@ -431,7 +431,7 @@ def commit(ref = 'HEAD')
# 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 @
ad8c54de
...
...
@@ -256,14 +256,17 @@ def path_for_ref(ref = pipeline.ref, job = build.name)
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