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
2530bc0c
Commit
2530bc0c
authored
Nov 04, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support returning a new pipelines
parent
c3ff1702
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
6 deletions
+12
-6
ee/app/controllers/projects/security/dashboard_controller.rb
ee/app/controllers/projects/security/dashboard_controller.rb
+1
-1
ee/app/models/ee/ci/pipeline.rb
ee/app/models/ee/ci/pipeline.rb
+7
-2
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+3
-2
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+1
-1
No files found.
ee/app/controllers/projects/security/dashboard_controller.rb
View file @
2530bc0c
...
...
@@ -5,7 +5,7 @@ module Projects
before_action
:authorize_read_project_security_dashboard!
def
show
@pipeline
=
@project
.
latest_pipeline_with_
legacy_
security_reports
@pipeline
=
@project
.
latest_pipeline_with_security_reports
&
.
present
(
current_user:
current_user
)
end
...
...
ee/app/models/ee/ci/pipeline.rb
View file @
2530bc0c
...
...
@@ -16,9 +16,14 @@ module EE
has_many
:vulnerabilities
,
source: :occurrence
,
through: :vulnerabilities_occurrence_pipelines
,
class_name:
'Vulnerabilities::Occurrence'
# Legacy way to fetch security reports based on job name. This has been replaced by the reports feature.
scope
:with_legacy_security_reports
,
->
{
scope
:with_legacy_security_reports
,
->
do
joins
(
:artifacts
).
where
(
ci_builds:
{
name:
%w[sast dependency_scanning sast:container container_scanning dast]
})
}
end
# The new `reports:` syntax reports
scope
:with_security_reports
,
->
do
where
(
'EXISTS (?)'
,
Ci
::
Build
.
select
(
1
).
latest
.
with_security_reports
.
where
(
'ci_pipelines.id=ci_build.commit_id'
))
end
# This structure describes feature levels
# to access the file types for given reports
...
...
ee/app/models/ee/project.rb
View file @
2530bc0c
...
...
@@ -109,8 +109,9 @@ module EE
end
end
def
latest_pipeline_with_legacy_security_reports
pipelines
.
newest_first
(
default_branch
).
with_legacy_security_reports
.
first
def
latest_pipeline_with_security_reports
pipelines
.
newest_first
(
default_branch
).
with_security_reports
.
first
||
pipelines
.
newest_first
(
default_branch
).
with_legacy_security_reports
.
first
end
def
environments_for_scope
(
scope
)
...
...
ee/spec/models/project_spec.rb
View file @
2530bc0c
...
...
@@ -1496,7 +1496,7 @@ describe Project do
end
end
describe
'#latest_pipeline_with_
legacy_
security_reports'
do
describe
'#latest_pipeline_with_security_reports'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:pipeline_1
)
{
create
(
:ci_pipeline_without_jobs
,
project:
project
)
}
let
(
:pipeline_2
)
{
create
(
:ci_pipeline_without_jobs
,
project:
project
)
}
...
...
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