Skip to content
代码片段 群组 项目
未验证 提交 e8af953e 编辑于 作者: Furkan Ayhan's avatar Furkan Ayhan 提交者: GitLab
浏览文件

Skip saving pipeline config when using inputs

Inputs may contain secrets, so we don't want to save them in the DB
as plain text. It's safe to not save a pipeline-config because we are
currently considering dropping the `p_ci_pipelines_config` table
because it's not used anywhere.
https://gitlab.com/gitlab-org/gitlab/-/issues/520828#note_2364398251

related to https://gitlab.com/gitlab-org/gitlab/-/issues/523238

Changelog: other
上级 b0b91b4e
No related branches found
No related tags found
无相关合并请求
...@@ -11,7 +11,7 @@ class Content < Chain::Base ...@@ -11,7 +11,7 @@ class Content < Chain::Base
def perform! def perform!
if pipeline_config&.exists? if pipeline_config&.exists?
@pipeline.build_pipeline_config(content: pipeline_config.content, project_id: @pipeline.project_id) build_pipeline_config
@command.config_content = pipeline_config.content @command.config_content = pipeline_config.content
@pipeline.config_source = pipeline_config.source @pipeline.config_source = pipeline_config.source
@command.pipeline_config = pipeline_config @command.pipeline_config = pipeline_config
...@@ -39,6 +39,16 @@ def pipeline_config ...@@ -39,6 +39,16 @@ def pipeline_config
) )
end end
end end
def build_pipeline_config
# Inputs may contain secrets, so we don't want to save them in the DB as plain text.
# It's safe to not save a pipeline-config because we are currently considering
# dropping the `p_ci_pipelines_config` table because it's not used anywhere.
# https://gitlab.com/gitlab-org/gitlab/-/issues/520828#note_2364398251
return if @command.inputs.present?
@pipeline.build_pipeline_config(content: pipeline_config.content, project_id: @pipeline.project_id)
end
end end
end end
end end
......
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
subject.perform! subject.perform!
expect(pipeline.config_source).to eq 'repository_source' expect(pipeline.config_source).to eq 'repository_source'
expect(pipeline.pipeline_config.content).to eq(config_content_result) expect(pipeline.pipeline_config).to be_nil
expect(command.config_content).to eq(config_content_result) expect(command.config_content).to eq(config_content_result)
expect(command.pipeline_config.internal_include_prepended?).to eq(true) expect(command.pipeline_config.internal_include_prepended?).to eq(true)
expect(command.pipeline_config.inputs_for_pipeline_creation).to eq({}) expect(command.pipeline_config.inputs_for_pipeline_creation).to eq({})
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
subject.perform! subject.perform!
expect(pipeline.config_source).to eq 'parameter_source' expect(pipeline.config_source).to eq 'parameter_source'
expect(pipeline.pipeline_config.content).to eq(content) expect(pipeline.pipeline_config).to be_nil
expect(command.config_content).to eq(content) expect(command.config_content).to eq(content)
expect(command.pipeline_config.internal_include_prepended?).to eq(false) expect(command.pipeline_config.internal_include_prepended?).to eq(false)
expect(command.pipeline_config.inputs_for_pipeline_creation).to eq(inputs) expect(command.pipeline_config.inputs_for_pipeline_creation).to eq(inputs)
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册