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
96d1baa3
Commit
96d1baa3
authored
Nov 20, 2020
by
Philip Cunningham
Committed by
Fabio Pitino
Nov 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce On-Demand CI YAML raw string size
Uses the DAST template to avoid storing whole CI YAML in the db.
parent
c221a8e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
ee/app/services/ci/run_dast_scan_service.rb
ee/app/services/ci/run_dast_scan_service.rb
+12
-7
ee/spec/services/ci/run_dast_scan_service_spec.rb
ee/spec/services/ci/run_dast_scan_service_spec.rb
+7
-2
No files found.
ee/app/services/ci/run_dast_scan_service.rb
View file @
96d1baa3
...
...
@@ -11,15 +11,20 @@ module Ci
full_scan_enabled:
'DAST_FULL_SCAN_ENABLED'
}.
freeze
def
self
.
ci_template
_raw
@ci_template
_raw
||=
Gitlab
::
Template
::
GitlabCiYmlTemplate
.
find
(
'DAST'
).
content
def
self
.
ci_template
@ci_template
||=
YAML
.
safe_load
(
ci_template_raw
)
end
def
self
.
ci_template
@ci_template
||=
YAML
.
safe_load
(
ci_template_raw
).
tap
do
|
template
|
template
[
'stages'
]
=
[
'dast'
]
template
[
'dast'
].
delete
(
'rules'
)
end
def
self
.
ci_template_raw
<<~
YAML
include:
- template: DAST.gitlab-ci.yml
stages:
- dast
dast:
rules:
- when: always
YAML
end
def
execute
(
branch
:,
**
args
)
...
...
ee/spec/services/ci/run_dast_scan_service_spec.rb
View file @
96d1baa3
...
...
@@ -24,8 +24,13 @@ RSpec.describe Ci::RunDastScanService do
expect
(
described_class
.
ci_template
[
'stages'
]).
to
eq
([
'dast'
])
end
it
'has has no rules'
do
expect
(
described_class
.
ci_template
[
'dast'
][
'rules'
]).
to
be_nil
it
'has one rule is always true'
do
rules
=
described_class
.
ci_template
[
'dast'
][
'rules'
]
aggregate_failures
do
expect
(
rules
.
size
).
to
eq
(
1
)
expect
(
rules
).
to
include
(
'when'
=>
'always'
)
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