Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
94cb5cf7da
commit
b2066dcc69
|
@ -41,7 +41,7 @@ module Security
|
||||||
end
|
end
|
||||||
|
|
||||||
def existing_gitlab_ci_content
|
def existing_gitlab_ci_content
|
||||||
@gitlab_ci_yml ||= project.repository.gitlab_ci_yml_for(project.repository.root_ref_sha)
|
@gitlab_ci_yml ||= project.ci_config_for(project.repository.root_ref_sha)
|
||||||
YAML.safe_load(@gitlab_ci_yml) if @gitlab_ci_yml
|
YAML.safe_load(@gitlab_ci_yml) if @gitlab_ci_yml
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ module Security
|
||||||
private
|
private
|
||||||
|
|
||||||
def action
|
def action
|
||||||
Security::CiConfiguration::ContainerScanningBuildAction.new(project.auto_devops_enabled?, existing_gitlab_ci_content).generate
|
Security::CiConfiguration::ContainerScanningBuildAction.new(project.auto_devops_enabled?, existing_gitlab_ci_content,
|
||||||
|
project.ci_config_path).generate
|
||||||
end
|
end
|
||||||
|
|
||||||
def next_branch
|
def next_branch
|
||||||
|
|
|
@ -6,7 +6,8 @@ module Security
|
||||||
private
|
private
|
||||||
|
|
||||||
def action
|
def action
|
||||||
Security::CiConfiguration::DependencyScanningBuildAction.new(project.auto_devops_enabled?, existing_gitlab_ci_content).generate
|
Security::CiConfiguration::DependencyScanningBuildAction.new(project.auto_devops_enabled?, existing_gitlab_ci_content,
|
||||||
|
project.ci_config_path).generate
|
||||||
end
|
end
|
||||||
|
|
||||||
def next_branch
|
def next_branch
|
||||||
|
|
|
@ -26,7 +26,7 @@ module Security
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
Security::CiConfiguration::SastBuildAction.new(project.auto_devops_enabled?, params, existing_content).generate
|
Security::CiConfiguration::SastBuildAction.new(project.auto_devops_enabled?, params, existing_content, project.ci_config_path).generate
|
||||||
end
|
end
|
||||||
|
|
||||||
def next_branch
|
def next_branch
|
||||||
|
|
|
@ -6,7 +6,8 @@ module Security
|
||||||
private
|
private
|
||||||
|
|
||||||
def action
|
def action
|
||||||
Security::CiConfiguration::SastIacBuildAction.new(project.auto_devops_enabled?, existing_gitlab_ci_content).generate
|
Security::CiConfiguration::SastIacBuildAction.new(project.auto_devops_enabled?, existing_gitlab_ci_content,
|
||||||
|
project.ci_config_path).generate
|
||||||
end
|
end
|
||||||
|
|
||||||
def next_branch
|
def next_branch
|
||||||
|
|
|
@ -6,7 +6,8 @@ module Security
|
||||||
private
|
private
|
||||||
|
|
||||||
def action
|
def action
|
||||||
Security::CiConfiguration::SecretDetectionBuildAction.new(project.auto_devops_enabled?, existing_gitlab_ci_content).generate
|
Security::CiConfiguration::SecretDetectionBuildAction.new(project.auto_devops_enabled?, existing_gitlab_ci_content,
|
||||||
|
project.ci_config_path).generate
|
||||||
end
|
end
|
||||||
|
|
||||||
def next_branch
|
def next_branch
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
module Security
|
module Security
|
||||||
module CiConfiguration
|
module CiConfiguration
|
||||||
class BaseBuildAction
|
class BaseBuildAction
|
||||||
def initialize(auto_devops_enabled, existing_gitlab_ci_content)
|
def initialize(auto_devops_enabled, existing_gitlab_ci_content, ci_config_path = ::Ci::Pipeline::DEFAULT_CONFIG_PATH)
|
||||||
@auto_devops_enabled = auto_devops_enabled
|
@auto_devops_enabled = auto_devops_enabled
|
||||||
@existing_gitlab_ci_content = existing_gitlab_ci_content || {}
|
@existing_gitlab_ci_content = existing_gitlab_ci_content || {}
|
||||||
|
@ci_config_path = ci_config_path || ::Ci::Pipeline::DEFAULT_CONFIG_PATH
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate
|
def generate
|
||||||
|
@ -13,7 +14,7 @@ module Security
|
||||||
|
|
||||||
update_existing_content!
|
update_existing_content!
|
||||||
|
|
||||||
{ action: action, file_path: '.gitlab-ci.yml', content: prepare_existing_content, default_values_overwritten: @default_values_overwritten }
|
{ action: action, file_path: @ci_config_path, content: prepare_existing_content, default_values_overwritten: @default_values_overwritten }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
module Security
|
module Security
|
||||||
module CiConfiguration
|
module CiConfiguration
|
||||||
class SastBuildAction < BaseBuildAction
|
class SastBuildAction < BaseBuildAction
|
||||||
def initialize(auto_devops_enabled, params, existing_gitlab_ci_content)
|
def initialize(auto_devops_enabled, params, existing_gitlab_ci_content, ci_config_path = ::Ci::Pipeline::DEFAULT_CONFIG_PATH)
|
||||||
super(auto_devops_enabled, existing_gitlab_ci_content)
|
super(auto_devops_enabled, existing_gitlab_ci_content, ci_config_path)
|
||||||
@variables = variables(params)
|
@variables = variables(params)
|
||||||
@default_sast_values = default_sast_values(params)
|
@default_sast_values = default_sast_values(params)
|
||||||
@default_values_overwritten = false
|
@default_values_overwritten = false
|
||||||
|
|
|
@ -76,6 +76,18 @@ RSpec.shared_examples_for 'services security ci configuration create service' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when the project has a non-default ci config file' do
|
||||||
|
before do
|
||||||
|
project.ci_config_path = 'non-default/.gitlab-ci.yml'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does track the snowplow event' do
|
||||||
|
subject
|
||||||
|
|
||||||
|
expect_snowplow_event(**snowplow_event)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
unless skip_w_params
|
unless skip_w_params
|
||||||
context 'with parameters' do
|
context 'with parameters' do
|
||||||
let(:params) { non_empty_params }
|
let(:params) { non_empty_params }
|
||||||
|
|
Loading…
Reference in New Issue