lib/evrone/ci/router/build.rb in evrone-ci-router-0.2.0.pre1 vs lib/evrone/ci/router/build.rb in evrone-ci-router-0.2.0.pre3
- old
+ new
@@ -11,25 +11,27 @@
FAILED = 5
include Router::Helper::Logger
include Router::Helper::Config
- attr_reader :message, :output
- attr_accessor :matrix, :jobs_count, :commit_info
+ attr_reader :message, :output, :output_counter
+ attr_accessor :jobs_count, :commit_info
def initialize(perform_build_message)
- @output = ''
- @message = perform_build_message
+ @output_counter = 0
+ @output = ''
+ @message = perform_build_message
end
def to_perform_job_message(travis, job_id)
script_builder = travis.to_script_builder
+ sha = (commit_info && commit_info.sha) || message.sha
job_message = Message::PerformJob.new(
id: message.id,
name: message.name,
src: message.src,
- sha: message.sha,
+ sha: sha,
pull_request_id: message.pull_request_id,
deploy_key: message.deploy_key,
job_id: job_id,
before_script: script_builder.to_before_script,
script: script_builder.to_script,
@@ -43,11 +45,10 @@
attributes = {
build_id: message.id,
status: status,
tm: tm.to_i,
tm_usec: tm.usec,
- matrix: matrix || [],
jobs_count: jobs_count || 0,
}
if commit_info
attributes.merge!(
@@ -69,14 +70,13 @@
def add_command_to_output(cmd)
add_to_output "$ #{cmd}\n"
end
def create_build_log_message(data)
- tm = Time.now
+ @output_counter += 1
Message::BuildLog.new(
build_id: message.id,
- tm: tm.to_i,
- tm_usec: tm.usec,
+ tm: @output_counter,
log: data
)
end
end