debian-mirror-gitlab/lib/gitlab/ci/pipeline/chain/config/content.rb

49 lines
1.3 KiB
Ruby
Raw Normal View History

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-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
2020-04-22 19:07:51 +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
end
end
end
end
end
end