Class: Gitlab::Ci::ProjectConfig::Source

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/ci/project_config/source.rb

Instance Method Summary collapse

Constructor Details

#initialize(project:, sha:, custom_content: nil, pipeline_source: nil, pipeline_source_bridge: nil, triggered_for_branch: false, ref: nil, inputs: {}) ⇒ Source

Returns a new instance of Source.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gitlab/ci/project_config/source.rb', line 9

def initialize(
  project:, sha:, custom_content: nil, pipeline_source: nil, pipeline_source_bridge: nil,
  triggered_for_branch: false, ref: nil, inputs: {})
  @project = project
  @sha = sha
  @custom_content = custom_content
  @pipeline_source = pipeline_source
  @pipeline_source_bridge = pipeline_source_bridge
  @triggered_for_branch = triggered_for_branch
  @ref = ref
  @inputs = inputs
end

Instance Method Details

#contentObject

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/gitlab/ci/project_config/source.rb', line 28

def content
  raise NotImplementedError
end

#exists?Boolean

Returns:

  • (Boolean)


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

def exists?
  strong_memoize(:exists) do
    content.present?
  end
end

#inputs_for_pipeline_creationObject



45
46
47
48
# File 'lib/gitlab/ci/project_config/source.rb', line 45

def inputs_for_pipeline_creation
  # For internal_include_prepended?, we already pass the inputs to the `include` statement.
  internal_include_prepended? ? {} : inputs
end

#internal_include_prepended?Boolean

Indicates if we are prepending the content with an “internal” ‘include`

Returns:

  • (Boolean)


33
34
35
# File 'lib/gitlab/ci/project_config/source.rb', line 33

def internal_include_prepended?
  false
end

#sourceObject

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/gitlab/ci/project_config/source.rb', line 37

def source
  raise NotImplementedError
end

#urlObject



41
42
43
# File 'lib/gitlab/ci/project_config/source.rb', line 41

def url
  nil
end