_build.html.haml 3.63 KB
Newer Older
1 2
- job = build.present(current_user: current_user)
- pipeline = job.pipeline
Katarzyna Kobierska's avatar
Katarzyna Kobierska committed
3 4 5 6
- admin = local_assigns.fetch(:admin, false)
- ref = local_assigns.fetch(:ref, nil)
- commit_sha = local_assigns.fetch(:commit_sha, nil)
- retried = local_assigns.fetch(:retried, false)
7
- pipeline_link = local_assigns.fetch(:pipeline_link, false)
Katarzyna Kobierska's avatar
Katarzyna Kobierska committed
8 9
- stage = local_assigns.fetch(:stage, false)
- allow_retry = local_assigns.fetch(:allow_retry, false)
10

11
%tr.build.commit{ class: ('retried' if retried) }
12
  %td.status
13
    = render "ci/status/badge", status: job.detailed_status(current_user), title: job.status_title
14

15
  %td.branch-commit
16
    - if can?(current_user, :read_build, job)
17
      = link_to project_job_path(job.project, job) do
18
        %span.build-link ##{job.id}
19
    - else
20
      %span.build-link ##{job.id}
21

22
    - if ref
23
      - if job.ref
Annabel Dunstone's avatar
Annabel Dunstone committed
24
        .icon-container
25
          = job.tag? ? icon('tag') : icon('code-fork')
26
        = link_to job.ref, project_ref_path(job.project, job.ref), class: "ref-name"
27 28
      - else
        .light none
Annabel Dunstone Gray's avatar
Annabel Dunstone Gray committed
29
      .icon-container.commit-icon
30
        = custom_icon("icon_commit")
Annabel Dunstone's avatar
Annabel Dunstone committed
31

32
    - if commit_sha
33
      = link_to job.short_sha, project_commit_path(job.project, job.sha), class: "commit-sha"
Annabel Dunstone's avatar
Annabel Dunstone committed
34

35
    - if job.stuck?
Filipa Lacerda's avatar
Filipa Lacerda committed
36
      = icon('warning', class: 'text-warning has-tooltip', title: 'Job is stuck. Check runners.')
37

38
    - if retried
39
      = icon('refresh', class: 'text-warning has-tooltip', title: 'Job was retried')
40

41
    .label-container
42 43
      - if job.tags.any?
        - job.tags.each do |tag|
44 45
          %span.label.label-primary
            = tag
46
      - if job.try(:trigger_request)
47
        %span.label.label-info triggered
48
      - if job.try(:allow_failure)
49
        %span.label.label-danger allowed to fail
50
      - if job.action?
51
        %span.label.label-info manual
52

53 54
  - if pipeline_link
    %td
55 56
      = link_to pipeline_path(pipeline) do
        %span.pipeline-id ##{pipeline.id}
57
      %span by
58 59
      - if pipeline.user
        = user_avatar(user: pipeline.user, size: 20)
60
      - else
61
        %span.api API
62

63 64
  - if admin
    %td
65
      - if job.project
66
        = link_to job.project.name_with_namespace, admin_project_path(job.project)
67
    %td
68 69
      - if job.try(:runner)
        = runner_link(job.runner)
70 71 72
      - else
        .light none

73
  - if stage
Katarzyna Kobierska's avatar
Katarzyna Kobierska committed
74
    %td
75
      = job.stage
76 77

  %td
78
    = job.name
79

Annabel Dunstone's avatar
Annabel Dunstone committed
80
  %td
81
    - if job.duration
Annabel Dunstone's avatar
Annabel Dunstone committed
82
      %p.duration
83
        = custom_icon("icon_timer")
84
        = duration_in_numbers(job.duration)
85

86
    - if job.finished_at
Annabel Dunstone's avatar
Annabel Dunstone committed
87 88
      %p.finished-at
        = icon("calendar")
89
        %span= time_ago_with_tooltip(job.finished_at)
90

91
  %td.coverage
92
    - if job.try(:coverage)
93
      #{job.coverage}%
94 95 96

  %td
    .pull-right
97
      - if can?(current_user, :read_build, job) && job.artifacts?
98
        = link_to download_project_job_artifacts_path(job.project, job), rel: 'nofollow', download: '', title: 'Download artifacts', class: 'btn btn-build' do
99
          = sprite_icon('download')
100 101
      - if can?(current_user, :update_build, job)
        - if job.active?
102
          = link_to cancel_project_job_path(job.project, job, return_to: request.original_url), method: :post, title: 'Cancel', class: 'btn btn-build' do
Kamil Trzcinski's avatar
Kamil Trzcinski committed
103
            = icon('remove', class: 'cred')
104
        - elsif allow_retry
105
          - if job.playable? && !admin && can?(current_user, :update_build, job)
106
            = link_to play_project_job_path(job.project, job, return_to: request.original_url), method: :post, title: 'Play', class: 'btn btn-build' do
107
              = custom_icon('icon_play')
108
          - elsif job.retryable?
109
            = link_to retry_project_job_path(job.project, job, return_to: request.original_url), method: :post, title: 'Retry', class: 'btn btn-build' do
Kamil Trzcinski's avatar
Kamil Trzcinski committed
110
              = icon('repeat')