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
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
SOURCES = [
|
2020-07-28 23:09:34 +05:30
|
|
|
Gitlab::Ci::Pipeline::Chain::Config::Content::Parameter,
|
2020-03-13 15:44:24 +05:30
|
|
|
Gitlab::Ci::Pipeline::Chain::Config::Content::Bridge,
|
2020-01-01 13:55:28 +05:30
|
|
|
Gitlab::Ci::Pipeline::Chain::Config::Content::Repository,
|
|
|
|
Gitlab::Ci::Pipeline::Chain::Config::Content::ExternalProject,
|
|
|
|
Gitlab::Ci::Pipeline::Chain::Config::Content::Remote,
|
|
|
|
Gitlab::Ci::Pipeline::Chain::Config::Content::AutoDevops
|
|
|
|
].freeze
|
|
|
|
|
|
|
|
def perform!
|
|
|
|
if config = find_config
|
2020-04-22 19:07:51 +05:30
|
|
|
@pipeline.build_pipeline_config(content: config.content)
|
2020-01-01 13:55:28 +05:30
|
|
|
@command.config_content = config.content
|
|
|
|
@pipeline.config_source = config.source
|
|
|
|
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
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
def find_config
|
2021-03-11 19:13:27 +05:30
|
|
|
sources.each do |source|
|
2020-01-01 13:55:28 +05:30
|
|
|
config = source.new(@pipeline, @command)
|
|
|
|
return config if config.exists?
|
|
|
|
end
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
nil
|
|
|
|
end
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
def sources
|
|
|
|
SOURCES
|
|
|
|
end
|
2019-12-26 22:10:19 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
Gitlab::Ci::Pipeline::Chain::Config::Content.prepend_if_ee('EE::Gitlab::Ci::Pipeline::Chain::Config::Content')
|