Commit 86270b30 authored by Fabio Pitino's avatar Fabio Pitino

Merge branch 'review-on-demand-yaml-size-224463' into 'master'

Reduce On-Demand CI YAML raw string size

See merge request gitlab-org/gitlab!47401
parents 1e11c7fc 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
end
def self.ci_template
@ci_template ||= YAML.safe_load(ci_template_raw).tap do |template|
template['stages'] = ['dast']
template['dast'].delete('rules')
@ci_template ||= YAML.safe_load(ci_template_raw)
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)
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment