blob: f9fffbcb5177fb4a3d3cd54bf893310b4eb1d51c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# frozen_string_literal: true
module Gitlab
module Ci
module Pipeline
module Chain
module Config
class Content < Chain::Base
include Chain::Helpers
SOURCES = [
Gitlab::Ci::Pipeline::Chain::Config::Content::Runtime,
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
LEGACY_SOURCES = [
Gitlab::Ci::Pipeline::Chain::Config::Content::Runtime,
Gitlab::Ci::Pipeline::Chain::Config::Content::LegacyRepository,
Gitlab::Ci::Pipeline::Chain::Config::Content::LegacyAutoDevops
].freeze
def perform!
if config = find_config
@pipeline.build_pipeline_config(content: config.content) if ci_root_config_content_enabled?
@command.config_content = config.content
@pipeline.config_source = config.source
else
error('Missing CI config file')
end
end
def break?
@pipeline.errors.any? || @pipeline.persisted?
end
private
def find_config
sources.each do |source|
config = source.new(@pipeline, @command)
return config if config.exists?
end
nil
end
def sources
ci_root_config_content_enabled? ? SOURCES : LEGACY_SOURCES
end
def ci_root_config_content_enabled?
Feature.enabled?(:ci_root_config_content, @command.project, default_enabled: true)
end
end
end
end
end
end
end
|