Class: Gitlab::Ci::ProjectConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/ci/project_config.rb,
lib/gitlab/ci/project_config/bridge.rb,
lib/gitlab/ci/project_config/remote.rb,
lib/gitlab/ci/project_config/source.rb,
lib/gitlab/ci/project_config/parameter.rb,
lib/gitlab/ci/project_config/repository.rb,
lib/gitlab/ci/project_config/auto_devops.rb,
lib/gitlab/ci/project_config/external_project.rb

Overview

Locates project CI config

Defined Under Namespace

Classes: AutoDevops, Bridge, ExternalProject, Parameter, Remote, Repository, Source

Constant Summary collapse

SOURCES =

The order of sources is important:

  • EE uses Compliance first since it must be used first if compliance templates are enabled. (see ee/lib/ee/gitlab/ci/project_config.rb)

  • Parameter is used by on-demand security scanning which passes the actual CI YAML to use as argument.

  • Bridge is used for downstream pipelines since the config is defined in the bridge job. If lower in priority, it would evaluate the project’s YAML file instead.

  • Repository / ExternalProject / Remote: their order is not important between each other.

  • AutoDevops is used as default option if nothing else is found and if AutoDevops is enabled.

[
  ProjectConfig::Parameter,
  ProjectConfig::Bridge,
  ProjectConfig::Repository,
  ProjectConfig::ExternalProject,
  ProjectConfig::Remote,
  ProjectConfig::AutoDevops
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(project:, sha:, custom_content: nil, pipeline_source: nil, pipeline_source_bridge: nil) ⇒ ProjectConfig

Returns a new instance of ProjectConfig.



24
25
26
# File 'lib/gitlab/ci/project_config.rb', line 24

def initialize(project:, sha:, custom_content: nil, pipeline_source: nil, pipeline_source_bridge: nil)
  @config = find_config(project, sha, custom_content, pipeline_source, pipeline_source_bridge)
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/gitlab/ci/project_config.rb', line 31

def exists?
  !!@config&.exists?
end