Class: BulkImports::Projects::Pipelines::DesignBundlePipeline

Inherits:
Object
  • Object
show all
Includes:
BulkImports::Pipeline
Defined in:
lib/bulk_imports/projects/pipelines/design_bundle_pipeline.rb

Constant Summary

Constants included from BulkImports::Pipeline

BulkImports::Pipeline::CACHE_KEY_EXPIRATION, BulkImports::Pipeline::EMPTY_EXPORT_STATUS_TIMEOUT, BulkImports::Pipeline::ExpiredError, BulkImports::Pipeline::FailedError, BulkImports::Pipeline::NDJSON_EXPORT_TIMEOUT, BulkImports::Pipeline::NotAllowedError

Constants included from BulkImports::Pipeline::Runner

BulkImports::Pipeline::Runner::MarkedAsFailedError

Instance Method Summary collapse

Methods included from BulkImports::Pipeline

#current_user, #import_export_config, #initialize, #portable, #tracker

Methods included from BulkImports::Pipeline::Runner

#run

Instance Method Details

#after_run(_) ⇒ Object



34
35
36
# File 'lib/bulk_imports/projects/pipelines/design_bundle_pipeline.rb', line 34

def after_run(_)
  FileUtils.remove_entry(tmpdir) if Dir.exist?(tmpdir)
end

#extract(_context) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/bulk_imports/projects/pipelines/design_bundle_pipeline.rb', line 12

def extract(_context)
  download_service.execute
  decompression_service.execute
  extraction_service.execute

  bundle_path = File.join(tmpdir, "#{self.class.relation}.bundle")

  BulkImports::Pipeline::ExtractedData.new(data: bundle_path)
end

#load(_context, bundle_path) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/bulk_imports/projects/pipelines/design_bundle_pipeline.rb', line 22

def load(_context, bundle_path)
  Gitlab::PathTraversal.check_path_traversal!(bundle_path)
  Gitlab::PathTraversal.check_allowed_absolute_path!(bundle_path, [Dir.tmpdir])

  return unless portable.lfs_enabled?
  return unless File.exist?(bundle_path)
  return if File.directory?(bundle_path)
  return if Gitlab::Utils::FileInfo.linked?(bundle_path)

  portable.design_repository.create_from_bundle(bundle_path)
end