Module: Ci::Artifactable

Extended by:
ActiveSupport::Concern
Included in:
JobArtifact, PipelineArtifact
Defined in:
app/models/concerns/ci/artifactable.rb

Constant Summary collapse

NotSupportedAdapterError =
Class.new(StandardError)
FILE_FORMAT_ADAPTERS =
{
  gzip: Gitlab::Ci::Build::Artifacts::Adapters::GzipStream,
  raw: Gitlab::Ci::Build::Artifacts::Adapters::RawStream
}.freeze

Instance Method Summary collapse

Instance Method Details

#each_blob(&blk) ⇒ Object


24
25
26
27
28
29
30
31
32
# File 'app/models/concerns/ci/artifactable.rb', line 24

def each_blob(&blk)
  unless file_format_adapter_class
    raise NotSupportedAdapterError, 'This file format requires a dedicated adapter'
  end

  file.open do |stream|
    file_format_adapter_class.new(stream).each_blob(&blk)
  end
end