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
c66b8747
Commit
c66b8747
authored
Jul 12, 2021
by
Adam Cohen
Committed by
Mark Chao
Jul 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure dependency list shows successful pipelines
parent
e378ebea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
9 deletions
+17
-9
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+1
-1
ee/spec/controllers/projects/licenses_controller_spec.rb
ee/spec/controllers/projects/licenses_controller_spec.rb
+2
-2
ee/spec/features/projects/licenses/maintainer_views_policies_spec.rb
...tures/projects/licenses/maintainer_views_policies_spec.rb
+1
-1
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+13
-5
No files found.
ee/app/models/ee/project.rb
View file @
c66b8747
...
...
@@ -323,7 +323,7 @@ module EE
end
def
latest_pipeline_with_reports
(
reports
)
all_pipelines
.
newest_first
(
ref:
default_branch
).
with_reports
(
reports
).
take
all_pipelines
.
success
.
newest_first
(
ref:
default_branch
).
with_reports
(
reports
).
take
end
def
security_reports_up_to_date_for_ref?
(
ref
)
...
...
ee/spec/controllers/projects/licenses_controller_spec.rb
View file @
c66b8747
...
...
@@ -70,7 +70,7 @@ RSpec.describe Projects::LicensesController do
end
context
'with existing report'
do
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
builds:
[
create
(
:ee_ci_build
,
:success
,
:license_scan_v2_1
)])
}
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
builds:
[
create
(
:ee_ci_build
,
:success
,
:license_scan_v2_1
)]
,
status: :success
)
}
before
do
get_licenses
...
...
@@ -127,7 +127,7 @@ RSpec.describe Projects::LicensesController do
let_it_be
(
:mit_policy
)
{
create
(
:software_license_policy
,
:denied
,
software_license:
mit
,
project:
project
)
}
let_it_be
(
:other_license
)
{
create
(
:software_license
,
spdx_identifier:
"Other-Id"
)
}
let_it_be
(
:other_license_policy
)
{
create
(
:software_license_policy
,
:allowed
,
software_license:
other_license
,
project:
project
)
}
let_it_be
(
:pipeline
)
{
create
(
:ee_ci_pipeline
,
project:
project
,
builds:
[
create
(
:ee_ci_build
,
:license_scan_v2_1
,
:success
)])
}
let_it_be
(
:pipeline
)
{
create
(
:ee_ci_pipeline
,
project:
project
,
builds:
[
create
(
:ee_ci_build
,
:license_scan_v2_1
,
:success
)]
,
status: :success
)
}
context
"when loading all policies"
do
before
do
...
...
ee/spec/features/projects/licenses/maintainer_views_policies_spec.rb
View file @
c66b8747
...
...
@@ -28,7 +28,7 @@ RSpec.describe 'EE > Projects > Licenses > Maintainer views policies', :js do
context
"when a policy is configured"
do
let_it_be
(
:mit
)
{
create
(
:software_license
,
:mit
)
}
let_it_be
(
:mit_policy
)
{
create
(
:software_license_policy
,
:denied
,
software_license:
mit
,
project:
project
)
}
let_it_be
(
:pipeline
)
{
create
(
:ee_ci_pipeline
,
project:
project
,
builds:
[
create
(
:ee_ci_build
,
:license_scan_v2
,
:success
)])
}
let_it_be
(
:pipeline
)
{
create
(
:ee_ci_pipeline
,
project:
project
,
builds:
[
create
(
:ee_ci_build
,
:license_scan_v2
,
:success
)]
,
status: :success
)
}
let
(
:report
)
{
Gitlab
::
Json
.
parse
(
fixture_file
(
'security_reports/gl-license-scanning-report-v2.json'
,
dir:
'ee'
))
}
let
(
:known_licenses
)
{
report
[
'licenses'
].
find_all
{
|
license
|
license
[
'url'
].
present?
}
}
...
...
ee/spec/models/project_spec.rb
View file @
c66b8747
...
...
@@ -1791,19 +1791,27 @@ RSpec.describe Project do
end
describe
'#latest_pipeline_with_reports'
do
let
(
:project
)
{
create
(
:project
)
}
let
!
(
:pipeline_1
)
{
create
(
:ee_ci_pipeline
,
:with_sast_report
,
project:
project
)
}
let
!
(
:pipeline_2
)
{
create
(
:ee_ci_pipeline
,
:with_sast_report
,
project:
project
)
}
let
!
(
:pipeline_3
)
{
create
(
:ee_ci_pipeline
,
:with_dependency_scanning_report
,
project:
project
)
}
let
_it_be
(
:project
)
{
create
(
:project
)
}
let
_it_be
(
:pipeline_1
)
{
create
(
:ee_ci_pipeline
,
:with_sast_report
,
project:
project
)
}
let
_it_be
(
:pipeline_2
)
{
create
(
:ee_ci_pipeline
,
:with_sast_report
,
project:
project
)
}
let
_it_be
(
:pipeline_3
)
{
create
(
:ee_ci_pipeline
,
:with_dependency_scanning_report
,
project:
project
)
}
subject
{
project
.
latest_pipeline_with_reports
(
reports
)
}
context
'when reports are found'
do
let
(
:reports
)
{
::
Ci
::
JobArtifact
.
sast_reports
}
let
_it_be
(
:reports
)
{
::
Ci
::
JobArtifact
.
sast_reports
}
it
"returns the latest pipeline with reports of right type"
do
is_expected
.
to
eq
(
pipeline_2
)
end
context
'and one of the pipelines has not yet completed'
do
let_it_be
(
:pipeline_4
)
{
create
(
:ee_ci_pipeline
,
:with_sast_report
,
project:
project
,
status: :running
)
}
it
'returns the latest successful pipeline with reports'
do
is_expected
.
to
eq
(
pipeline_2
)
end
end
end
context
'when reports are not found'
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