Class: Gitlab::Ci::Config::External::File::Artifact

Inherits:
Base
  • Object
show all
Extended by:
Utils::Override
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/ci/config/external/file/artifact.rb

Constant Summary

Constants inherited from Base

Base::YAML_WHITELIST_EXTENSION

Instance Attribute Summary collapse

Attributes inherited from Base

#context, #errors, #location, #params

Instance Method Summary collapse

Methods included from Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods inherited from Base

#error_message, #invalid_extension?, #invalid_location_type?, #to_hash, #valid?

Constructor Details

#initialize(params, context) ⇒ Artifact

Returns a new instance of Artifact.


14
15
16
17
18
19
# File 'lib/gitlab/ci/config/external/file/artifact.rb', line 14

def initialize(params, context)
  @location = params[:artifact]
  @job_name = params[:job]

  super
end

Instance Attribute Details

#job_nameObject (readonly)

Returns the value of attribute job_name


12
13
14
# File 'lib/gitlab/ci/config/external/file/artifact.rb', line 12

def job_name
  @job_name
end

Instance Method Details

#contentObject


21
22
23
24
25
26
27
28
29
# File 'lib/gitlab/ci/config/external/file/artifact.rb', line 21

def content
  strong_memoize(:content) do
    next unless artifact_job

    Gitlab::Ci::ArtifactFileReader.new(artifact_job).read(location)
  rescue Gitlab::Ci::ArtifactFileReader::Error => error
    errors.push(error.message)
  end
end

#matching?Boolean

Returns:

  • (Boolean)

31
32
33
34
# File 'lib/gitlab/ci/config/external/file/artifact.rb', line 31

def matching?
  super &&
    Feature.enabled?(:ci_dynamic_child_pipeline, project, default_enabled: true)
end