builds_helper.rb 890 Bytes
Newer Older
1
module BuildsHelper
2
  def build_summary(build, skip: false)
3
    if build.has_trace?
4
      if skip
5
        link_to "View job trace", pipeline_job_url(build.pipeline, build)
6 7 8
      else
        build.trace.html(last_lines: 10).html_safe
      end
9 10 11 12 13
    else
      "No job trace"
    end
  end

14 15
  def sidebar_build_class(build, current_build)
    build_class = ''
Eric Eastwood's avatar
Eric Eastwood committed
16
    build_class += ' active' if build.id === current_build.id
17
    build_class += ' retried' if build.retried?
18
    build_class
19
  end
20 21 22

  def javascript_build_options
    {
23 24
      page_url: project_job_url(@project, @build),
      build_url: project_job_url(@project, @build, :json),
25 26
      build_status: @build.status,
      build_stage: @build.stage,
27
      log_state: ''
28 29
    }
  end
Alex Sanford's avatar
Alex Sanford committed
30 31 32 33

  def build_failed_issue_options
    {
      title: "Build Failed ##{@build.id}",
34
      description: project_job_url(@project, @build)
Alex Sanford's avatar
Alex Sanford committed
35 36
    }
  end
37
end