require 'evrone/ci/message' require 'evrone/ci/common' module Evrone module CI module Worker class Job include Helper::Logger attr_reader :output, :message def initialize(perform_job_message) @output = "" @message = perform_job_message end def add_to_output(str) output << str logger.debug str.strip if logger.level == 0 JobLogsConsumer.publish create_job_log_message(str) end def add_command_to_output(cmd) add_to_output "$ #{cmd}\n" end def create_job_log_message(data) tm = Time.now Message::JobLog.new( build_id: message.id, job_id: message.job_id, tm: tm.to_i, tm_usec: tm.usec, log: data ) end end end end end