Sha256: 64569895e3d42d8fc3e00a3e07ff6721349806668c8cec71965dd97ef1f08324
Contents?: true
Size: 1.61 KB
Versions: 2
Compression:
Stored size: 1.61 KB
Contents
class KuberKit::Actions::ImageCompiler include KuberKit::Import[ "image_compiler.compiler", "image_compiler.image_dependency_resolver", "shell.local_shell", "tools.logger", "configs", "ui" ] Contract ArrayOf[Symbol], Hash => Any def call(image_names, options) build_id = generate_build_id resolved_dependencies = [] dependencies = image_dependency_resolver.get_next(image_names) while (dependencies - resolved_dependencies).any? compile_simultaneously(dependencies, build_id) resolved_dependencies += dependencies dependencies = image_dependency_resolver.get_next(image_names, resolved: resolved_dependencies) end compile_simultaneously(image_names - resolved_dependencies, build_id) end private def compile_simultaneously(image_names, build_id) task_group = ui.create_task_group image_names.map do |image_name| logger.info("Started compiling: #{image_name.to_s.green}") task_group.add("Compiling #{image_name.to_s.yellow}") do |task| compile_image(image_name, build_id) task.update_title("Compiled #{image_name.to_s.green}") logger.info("Finished compiling: #{image_name.to_s.green}") end end task_group.wait end def compile_image(image_name, build_id) compile_dir = generate_compile_dir(build_id: build_id) image_compiler.compile(local_shell, image_name, compile_dir) end def generate_build_id Time.now.strftime("%H%M%S") end def generate_compile_dir(build_id:) File.join(configs.image_compile_dir, build_id) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kuber_kit-0.1.1 | lib/kuber_kit/actions/image_compiler.rb |
kuber_kit-0.1.0 | lib/kuber_kit/actions/image_compiler.rb |