2016-10-13 19:59:23 +00:00
|
|
|
module BuildsHelper
|
2017-05-04 18:30:13 +00:00
|
|
|
def build_summary(build, skip: false)
|
2017-04-16 01:33:01 +00:00
|
|
|
if build.has_trace?
|
2017-05-04 18:30:13 +00:00
|
|
|
if skip
|
2017-05-16 11:41:15 +00:00
|
|
|
link_to "View job trace", pipeline_job_url(build.pipeline, build)
|
2017-05-04 18:30:13 +00:00
|
|
|
else
|
|
|
|
build.trace.html(last_lines: 10).html_safe
|
|
|
|
end
|
2017-04-16 01:33:01 +00:00
|
|
|
else
|
|
|
|
"No job trace"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-10-13 19:59:23 +00:00
|
|
|
def sidebar_build_class(build, current_build)
|
|
|
|
build_class = ''
|
2017-02-10 22:14:18 +00:00
|
|
|
build_class += ' active' if build.id === current_build.id
|
2016-10-13 19:59:23 +00:00
|
|
|
build_class += ' retried' if build.retried?
|
2016-10-14 14:20:55 +00:00
|
|
|
build_class
|
2016-10-13 19:59:23 +00:00
|
|
|
end
|
2016-09-08 15:50:36 +00:00
|
|
|
|
|
|
|
def javascript_build_options
|
|
|
|
{
|
2017-06-29 17:06:35 +00:00
|
|
|
page_url: project_job_url(@project, @build),
|
|
|
|
build_url: project_job_url(@project, @build, :json),
|
2016-09-08 15:50:36 +00:00
|
|
|
build_status: @build.status,
|
|
|
|
build_stage: @build.stage,
|
2017-02-10 18:40:25 +00:00
|
|
|
log_state: ''
|
2016-09-08 15:50:36 +00:00
|
|
|
}
|
|
|
|
end
|
2017-02-22 23:42:14 +00:00
|
|
|
|
|
|
|
def build_failed_issue_options
|
|
|
|
{
|
|
|
|
title: "Build Failed ##{@build.id}",
|
2017-06-29 17:06:35 +00:00
|
|
|
description: project_job_url(@project, @build)
|
2017-02-22 23:42:14 +00:00
|
|
|
}
|
|
|
|
end
|
2016-10-13 19:59:23 +00:00
|
|
|
end
|