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
...
@@ -11,15 +11,20 @@ module Ci
full_scan_enabled:
'DAST_FULL_SCAN_ENABLED'
full_scan_enabled:
'DAST_FULL_SCAN_ENABLED'
}.
freeze
}.
freeze
def
self
.
ci_template
_raw
def
self
.
ci_template
@ci_template
_raw
||=
Gitlab
::
Template
::
GitlabCiYmlTemplate
.
find
(
'DAST'
).
content
@ci_template
||=
YAML
.
safe_load
(
ci_template_raw
)
end
end
def
self
.
ci_template
def
self
.
ci_template_raw
@ci_template
||=
YAML
.
safe_load
(
ci_template_raw
).
tap
do
|
template
|
<<~
YAML
template
[
'stages'
]
=
[
'dast'
]
include:
template
[
'dast'
].
delete
(
'rules'
)
- template: DAST.gitlab-ci.yml
end
stages:
- dast
dast:
rules:
- when: always
YAML
end
end
def
execute
(
branch
:,
**
args
)
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
...
@@ -24,8 +24,13 @@ RSpec.describe Ci::RunDastScanService do
expect
(
described_class
.
ci_template
[
'stages'
]).
to
eq
([
'dast'
])
expect
(
described_class
.
ci_template
[
'stages'
]).
to
eq
([
'dast'
])
end
end
it
'has has no rules'
do
it
'has one rule is always true'
do
expect
(
described_class
.
ci_template
[
'dast'
][
'rules'
]).
to
be_nil
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
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