class JamesBond::MissionKubernetes::BuildHandler

Attributes

config[RW]

Public Class Methods

new(command, config) click to toggle source
# File lib/james_bond/mission_kubernetes/build_handler.rb, line 9
def initialize(command, config)
  @command = command
  @config  = config.for(env: command.env, command: command.main_command)
end

Public Instance Methods

run() click to toggle source
# File lib/james_bond/mission_kubernetes/build_handler.rb, line 14
def run
  target = "#{config["image_name"]}:#{tag}"
  command = "docker build -t #{target} ."

  Open3.popen3(command) do |stdin, stdout, stderr, thread|
    Thread.new do
      until (line = stdout.gets).nil? do
        puts line
      end
    end

    thread.join
  end

  { tag: tag }
end
tag() click to toggle source
# File lib/james_bond/mission_kubernetes/build_handler.rb, line 31
def tag
  options = @command.options
  time_tag = "devel-#{Time.now.to_i}"
  @tag ||= if options && options[:tag]
             options[:tag]
           else
             time_tag
           end
end