Sha256: 4b42f269a062cbcc2ec341f65baa6b1cf2301bac0f094e1fe86cf1ef085adb55

Contents?: true

Size: 911 Bytes

Versions: 1

Compression:

Stored size: 911 Bytes

Contents

class KuberKit::ImageCompiler::ActionHandler
  include KuberKit::Import[
    "image_compiler.compiler",
    "core.image_store",
    "tools.build_dir_cleaner",
    "configs",
  ]

  Contract KuberKit::Shell::AbstractShell, Symbol, String => Any
  def call(shell, image_name, build_id)
    parent_dir = get_image_compile_parent_dir_for_shell(shell)

    image = image_store.get_image(image_name)

    build_dir_cleaner.call(parent_dir: parent_dir)
    
    compile_dir = generate_compile_dir(parent_dir: parent_dir, build_id: build_id)

    compiler.compile(shell, image, compile_dir)
  end

  private
    def generate_compile_dir(parent_dir:, build_id:)
      File.join(parent_dir, build_id)
    end

    def get_image_compile_parent_dir_for_shell(shell)
      if shell.is_a?(KuberKit::Shell::LocalShell)
        configs.image_compile_dir
      else
        configs.remote_image_compile_dir
      end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kuber_kit-0.9.2 lib/kuber_kit/image_compiler/action_handler.rb