Class: Dapp::Dimg::Build::Stage::ArtifactBase

Inherits:
Base
  • Object
show all
Defined in:
lib/dapp/dimg/build/stage/artifact_base.rb

Direct Known Subclasses

ArtifactDefault, ImportArtifact

Instance Attribute Summary

Attributes inherited from Base

#dimg, #next_stage, #prev_stage

Instance Method Summary collapse

Methods inherited from Base

#adding_custom_dir_mounts, #adding_mounts_by_type, #build!, #build_lock!, #builder_checksum, #config_custom_dir_mounts, #config_mounts_by_type, #dependencies_empty?, #empty?, #g_a_stage?, #git_artifacts_dependencies, #image, #image_add_custom_mounts, #image_add_mounts, #image_introspect, #initialize, #labels_custom_dir_mounts, #labels_mounts_by_type, #name, #next_g_a_stage, #prev_g_a_stage, #save_in_cache!, #signature

Methods included from Mod::Logging

#image_should_be_introspected?, #log_build, #log_image_build, #log_image_commands, #log_image_created_at, #log_image_details, #log_image_instructions, #log_image_size, #log_name, #log_name_context, #log_state

Methods included from Helper::Trivia

class_to_lowercase, #class_to_lowercase, #delete_file, #kwargs, #make_path, #search_file_upward

Methods included from Helper::Sha256

#hashsum, #paths_content_hashsum, #sha256

Constructor Details

This class inherits a constructor from Dapp::Dimg::Build::Stage::Base

Instance Method Details

#artifact?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/dapp/dimg/build/stage/artifact_base.rb', line 32

def artifact?
  true
end

#artifactsObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/dapp/dimg/build/stage/artifact_base.rb', line 21

def artifacts
  @artifacts ||= begin
    dimg.config.public_send("_#{name}").map do |artifact|
      artifact_dimg = ::Dapp::Dimg::Artifact.new(config: artifact._config,
                                                 dapp: dimg.dapp,
                                                 ignore_git_fetch: dimg.ignore_git_fetch)
      { name: artifact._config._name, options: artifact._artifact_options, dimg: artifact_dimg }
    end
  end
end

#dependenciesObject



6
7
8
# File 'lib/dapp/dimg/build/stage/artifact_base.rb', line 6

def dependencies
  @dependencies ||= artifacts_signatures
end

#prepare_imageObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/dapp/dimg/build/stage/artifact_base.rb', line 10

def prepare_image
  super
  artifacts_dimgs_build!
  artifacts_labels = {}
  artifacts.each do |artifact|
    apply_artifact(artifact, image)
    artifacts_labels["dapp-artifact-#{artifact[:name]}".to_sym] = artifact[:dimg].last_stage.image.built_id
  end
  image.add_service_change_label artifacts_labels
end