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
196c704c
Commit
196c704c
authored
Sep 22, 2020
by
Mehmet Emin INAC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pipeline information to security dashboard setup
parent
6e1ca128
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
8 deletions
+47
-8
ee/app/helpers/ee/projects_helper.rb
ee/app/helpers/ee/projects_helper.rb
+14
-1
ee/spec/helpers/projects_helper_spec.rb
ee/spec/helpers/projects_helper_spec.rb
+33
-7
No files found.
ee/app/helpers/ee/projects_helper.rb
View file @
196c704c
...
...
@@ -232,7 +232,7 @@ module EE
not_enabled_scanners_help_path:
help_page_path
(
'user/application_security/index'
,
anchor:
'quick-start'
),
no_pipeline_run_scanners_help_path:
new_project_pipeline_path
(
project
),
security_dashboard_help_path:
help_page_path
(
'user/application_security/security_dashboard/index'
)
}
}
.
merge!
(
security_dashboard_pipeline_data
(
project
))
end
end
...
...
@@ -328,5 +328,18 @@ module EE
codeClose:
'</code>'
.
html_safe
}
end
def
security_dashboard_pipeline_data
(
project
)
pipeline
=
project
.
latest_pipeline_with_security_reports
return
{}
unless
pipeline
{
pipeline:
{
id:
pipeline
.
id
,
path:
pipeline_path
(
pipeline
),
created_at:
pipeline
.
created_at
.
to_s
(
:iso8601
)
}
}
end
end
end
ee/spec/helpers/projects_helper_spec.rb
View file @
196c704c
...
...
@@ -142,11 +142,7 @@ RSpec.describe ProjectsHelper do
end
context
'project with vulnerabilities'
do
before
do
create
(
:vulnerability
,
project:
project
)
end
let
(
:expected_values
)
do
let
(
:base_values
)
do
{
has_vulnerabilities:
'true'
,
project:
{
id:
project
.
id
,
name:
project
.
name
},
...
...
@@ -158,11 +154,41 @@ RSpec.describe ProjectsHelper do
dashboard_documentation:
'/help/user/application_security/security_dashboard/index'
,
security_dashboard_help_path:
'/help/user/application_security/security_dashboard/index'
,
not_enabled_scanners_help_path:
help_page_path
(
'user/application_security/index'
,
anchor:
'quick-start'
),
no_pipeline_run_scanners_help_path:
new_project_pipeline_path
(
project
)
no_pipeline_run_scanners_help_path:
"/
#{
project
.
full_path
}
/-/pipelines/new"
}
end
it
{
is_expected
.
to
match
(
expected_values
)
}
before
do
create
(
:vulnerability
,
project:
project
)
end
context
'without pipeline'
do
before
do
allow
(
project
).
to
receive
(
:latest_pipeline_with_security_reports
).
and_return
(
nil
)
end
it
{
is_expected
.
to
match
(
base_values
)
}
end
context
'with pipeline'
do
let
(
:pipeline_created_at
)
{
'1881-05-19T00:00:00Z'
}
let
(
:pipeline
)
{
build_stubbed
(
:ci_pipeline
,
project:
project
,
created_at:
pipeline_created_at
)
}
let
(
:pipeline_values
)
do
{
pipeline:
{
id:
pipeline
.
id
,
path:
"/
#{
project
.
full_path
}
/-/pipelines/
#{
pipeline
.
id
}
"
,
created_at:
pipeline_created_at
}
}
end
before
do
allow
(
project
).
to
receive
(
:latest_pipeline_with_security_reports
).
and_return
(
pipeline
)
end
it
{
is_expected
.
to
match
(
base_values
.
merge!
(
pipeline_values
))
}
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