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
aef1c8d8
Commit
aef1c8d8
authored
Mar 17, 2020
by
Michał Zając
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use latest successful pipeline for default branch
parent
c61de9d3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
ee/app/models/vulnerability.rb
ee/app/models/vulnerability.rb
+2
-2
ee/spec/models/vulnerability_spec.rb
ee/spec/models/vulnerability_spec.rb
+6
-2
No files found.
ee/app/models/vulnerability.rb
View file @
aef1c8d8
...
@@ -74,8 +74,8 @@ class Vulnerability < ApplicationRecord
...
@@ -74,8 +74,8 @@ class Vulnerability < ApplicationRecord
end
end
def
resolved_on_default_branch
def
resolved_on_default_branch
latest_
pipeline_for_default_branch
=
project
.
pipeline_for
(
project_default_branch
)
latest_
successful_pipeline_for_default_branch
=
project
.
latest_successful_pipeline_for_default_branch
latest_pipeline_with_vulnerability
=
finding
.
pipelines
.
order
(
created_at: :desc
).
first
latest_pipeline_with_vulnerability
=
finding
.
pipelines
.
order
(
created_at: :desc
).
first
latest_pipeline_with_vulnerability
!=
latest_pipeline_for_default_branch
latest_pipeline_with_vulnerability
!=
latest_
successful_
pipeline_for_default_branch
end
end
end
end
ee/spec/models/vulnerability_spec.rb
View file @
aef1c8d8
...
@@ -183,7 +183,7 @@ describe Vulnerability do
...
@@ -183,7 +183,7 @@ describe Vulnerability do
describe
'#resolved_on_default_branch'
do
describe
'#resolved_on_default_branch'
do
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
:with_vulnerabilities
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
:with_vulnerabilities
)
}
let_it_be
(
:pipeline_with_vulnerability
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
)
}
let_it_be
(
:pipeline_with_vulnerability
)
{
create
(
:ci_pipeline
,
:success
,
project:
project
,
sha:
project
.
commit
.
id
)
}
let_it_be
(
:vulnerability
)
{
project
.
vulnerabilities
.
first
}
let_it_be
(
:vulnerability
)
{
project
.
vulnerabilities
.
first
}
let_it_be
(
:finding1
)
{
create
(
:vulnerabilities_occurrence
,
vulnerability:
vulnerability
,
pipelines:
[
pipeline_with_vulnerability
])
}
let_it_be
(
:finding1
)
{
create
(
:vulnerabilities_occurrence
,
vulnerability:
vulnerability
,
pipelines:
[
pipeline_with_vulnerability
])
}
let_it_be
(
:finding2
)
{
create
(
:vulnerabilities_occurrence
,
vulnerability:
vulnerability
,
pipelines:
[
pipeline_with_vulnerability
])
}
let_it_be
(
:finding2
)
{
create
(
:vulnerabilities_occurrence
,
vulnerability:
vulnerability
,
pipelines:
[
pipeline_with_vulnerability
])
}
...
@@ -195,7 +195,11 @@ describe Vulnerability do
...
@@ -195,7 +195,11 @@ describe Vulnerability do
end
end
context
'Vulnerability::Occurrence is not present on the pipeline for default branch'
do
context
'Vulnerability::Occurrence is not present on the pipeline for default branch'
do
let_it_be
(
:pipeline_without_vulnerability
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
)
}
before
do
project
.
instance_variable_set
(
:@latest_successful_pipeline_for_default_branch
,
pipeline_without_vulnerability
)
end
let_it_be
(
:pipeline_without_vulnerability
)
{
create
(
:ci_pipeline
,
:success
,
project:
project
,
sha:
project
.
commit
.
id
)
}
it
{
is_expected
.
to
eq
(
true
)
}
it
{
is_expected
.
to
eq
(
true
)
}
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