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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b2bb0196
Commit
b2bb0196
authored
Jun 15, 2021
by
Marius Bobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove retired builds from pipeline build matchers
Remove retired builds from pipeline build matchers
parent
689a2a6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+1
-1
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+22
-2
No files found.
app/models/ci/pipeline.rb
View file @
b2bb0196
...
...
@@ -1257,7 +1257,7 @@ module Ci
end
def
build_matchers
self
.
builds
.
build_matchers
(
project
)
self
.
builds
.
latest
.
build_matchers
(
project
)
end
private
...
...
spec/models/ci/pipeline_spec.rb
View file @
b2bb0196
...
...
@@ -4625,8 +4625,11 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
end
describe
'#build_matchers'
do
let_it_be
(
:pipeline
)
{
create
(
:ci_pipeline
)
}
let_it_be
(
:builds
)
{
create_list
(
:ci_build
,
2
,
pipeline:
pipeline
,
project:
pipeline
.
project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:pipeline
)
{
create
(
:ci_pipeline
,
user:
user
)
}
let_it_be
(
:builds
)
{
create_list
(
:ci_build
,
2
,
pipeline:
pipeline
,
project:
pipeline
.
project
,
user:
user
)
}
let
(
:project
)
{
pipeline
.
project
}
subject
(
:matchers
)
{
pipeline
.
build_matchers
}
...
...
@@ -4635,5 +4638,22 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
expect
(
matchers
).
to
all
be_a
(
Gitlab
::
Ci
::
Matching
::
BuildMatcher
)
expect
(
matchers
.
first
.
build_ids
).
to
match_array
(
builds
.
map
(
&
:id
))
end
context
'with retried builds'
do
let
(
:retried_build
)
{
builds
.
first
}
before
do
stub_not_protect_default_branch
project
.
add_developer
(
user
)
retried_build
.
cancel!
::
Ci
::
Build
.
retry
(
retried_build
,
user
)
end
it
'does not include retried builds'
do
expect
(
matchers
.
size
).
to
eq
(
1
)
expect
(
matchers
.
first
.
build_ids
).
not_to
include
(
retried_build
.
id
)
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