2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
module Pipeline
|
|
|
|
module Chain
|
|
|
|
module Config
|
|
|
|
class Content < Chain::Base
|
|
|
|
include Chain::Helpers
|
2022-10-11 01:57:18 +05:30
|
|
|
include ::Gitlab::Utils::StrongMemoize
|
2019-12-26 22:10:19 +05:30
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
def perform!
|
2022-10-11 01:57:18 +05:30
|
|
|
if pipeline_config&.exists?
|
|
|
|
@pipeline.build_pipeline_config(content: pipeline_config.content)
|
|
|
|
@command.config_content = pipeline_config.content
|
|
|
|
@pipeline.config_source = pipeline_config.source
|
2020-01-01 13:55:28 +05:30
|
|
|
else
|
|
|
|
error('Missing CI config file')
|
2019-12-26 22:10:19 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def break?
|
|
|
|
@pipeline.errors.any? || @pipeline.persisted?
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
def pipeline_config
|
|
|
|
strong_memoize(:pipeline_config) do
|
|
|
|
::Gitlab::Ci::ProjectConfig.new(
|
|
|
|
project: project, sha: @pipeline.sha,
|
|
|
|
custom_content: @command.content,
|
|
|
|
pipeline_source: @command.source, pipeline_source_bridge: @command.bridge
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2019-12-26 22:10:19 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|