Sha256: 6540c06eef591b1aa1400fe6fb872061955954a600b8cd8a747328c298c40fdd
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
class KuberKit::Actions::ImageCompiler include KuberKit::Import[ "image_compiler.image_dependency_resolver", "shell.local_shell", "tools.logger", "ui", image_compiler: "image_compiler.action_handler", ] 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| image_compiler.call(local_shell, 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 generate_build_id Time.now.strftime("%H%M%S") end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kuber_kit-0.1.7 | lib/kuber_kit/actions/image_compiler.rb |
kuber_kit-0.1.6 | lib/kuber_kit/actions/image_compiler.rb |