show.html.haml 6.8 KB
Newer Older
Douwe Maan's avatar
Douwe Maan committed
1
- page_title "#{@build.name} (##{@build.id})", "Builds"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
2 3
= render "header_title"

4
.build-page
5
  .gray-content-block.top-block
Kamil Trzcinski's avatar
Kamil Trzcinski committed
6
    Build ##{@build.id} for commit
7
    %strong.monospace= link_to @build.commit.short_sha, ci_status_path(@build.commit)
8
    from
Kamil Trzcinski's avatar
Kamil Trzcinski committed
9
    = link_to @build.ref, namespace_project_commits_path(@project.namespace, @project, @build.ref)
10 11 12 13
    - merge_request = @build.merge_request
    - if merge_request
      via
      = link_to "merge request ##{merge_request.iid}", merge_request_path(merge_request)
14 15

  #up-build-trace
Kamil Trzcinski's avatar
Kamil Trzcinski committed
16
  - if @commit.matrix_for_ref?(@build.ref)
17
    %ul.nav-links.no-top.no-bottom
18
      - @commit.latest_builds_for_ref(@build.ref).each do |build|
19 20 21 22 23 24 25 26 27
        %li{class: ('active' if build == @build) }
          = link_to namespace_project_build_path(@project.namespace, @project, build) do
            = ci_icon_for_status(build.status)
            %span
              - if build.name
                = build.name
              - else
                = build.id

Kamil Trzcinski's avatar
Kamil Trzcinski committed
28
      - if @build.retried?
29 30 31 32
        %li.active
          %a
            Build ##{@build.id}
            ·
Kamil Trzcinski's avatar
Kamil Trzcinski committed
33
            %i.fa.fa-warning
34 35
            This build was retried.

36
  .gray-content-block.middle-block
37 38 39 40 41 42 43 44
    .build-head
      .clearfix
        = ci_status_with_icon(@build.status)
        - if @build.duration
          %span
            %i.fa.fa-time
            #{duration_in_words(@build.finished_at, @build.started_at)}
        .pull-right
Kamil Trzcinski's avatar
Kamil Trzcinski committed
45
          #{time_ago_with_tooltip(@build.finished_at) if @build.finished_at}
46

47 48 49 50 51
  - if @build.show_warning?
    - unless @build.any_runners_online?
      .bs-callout.bs-callout-warning
        %p
          - if no_runners_for_project?(@build.project)
52
            This build is stuck, because the project doesn't have any runners online assigned to it.
53
          - elsif @build.tags.any?
54
            This build is stuck, because you don't have any active runners online with any of these tags assigned to them:
55 56 57 58
            - @build.tags.each do |tag|
              %span.label.label-primary
                = tag
          - else
59
            This build is stuck, because you don't have any active runners that can run this build.
60 61 62

          %br
          Go to
63
          = link_to namespace_project_runners_path(@build.project.namespace, @build.project) do
64 65
            Runners page

66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
  .row.prepend-top-default
    .col-md-9
      .clearfix
        - if @build.active?
          .autoscroll-container
            %button.btn.btn-success.btn-sm#autoscroll-button{:type => "button", :data => {:state => 'disabled'}} enable autoscroll
          .clearfix
      .scroll-controls
        = link_to '#up-build-trace', class: 'btn' do
          %i.fa.fa-angle-up
        = link_to '#down-build-trace', class: 'btn' do
          %i.fa.fa-angle-down

      %pre.trace#build-trace
        %code.bash
          = preserve do
            = raw @build.trace_html
      %div#down-build-trace

    .col-md-3
      - if @build.coverage
        .build-widget
          %h4.title
            Test coverage
          %h1 #{@build.coverage}%

92
      - if can?(current_user, :read_build, @project) && @build.artifacts?
93 94 95 96
        .build-widget.artifacts
          %h4.title Build artifacts
          .center
            .btn-group{ role: :group }
97 98 99 100
              = link_to @build.artifacts_download_url, class: 'btn btn-sm btn-primary' do
                = icon('download')
                Download

101
              - if @build.artifacts_metadata?
102 103 104
                = link_to @build.artifacts_browse_url, class: 'btn btn-sm btn-primary' do
                  = icon('folder-open')
                  Browse
105 106 107

      .build-widget
        %h4.title
Kamil Trzcinski's avatar
Kamil Trzcinski committed
108
          Build ##{@build.id}
109
          - if can?(current_user, :update_build, @project)
110
            .pull-right
Kamil Trzcinski's avatar
Kamil Trzcinski committed
111 112 113 114
              - if @build.cancel_url
                = link_to "Cancel", @build.cancel_url, class: 'btn btn-sm btn-danger', method: :post
              - elsif @build.retry_url
                = link_to "Retry", @build.retry_url, class: 'btn btn-sm btn-primary', method: :post
115

116 117 118 119 120 121 122 123 124 125
              = link_to '', class: 'btn btn-sm btn-danger', method: :delete,
                            data: { confirm: 'Are you sure you want to remove this?' } do
                = icon('remove')
                Remove

        .clearfix
          - if @build.duration
            %p
              %span.attr-name Duration:
              #{duration_in_words(@build.finished_at, @build.started_at)}
126
          %p
127 128 129 130 131 132
            %span.attr-name Created:
            #{time_ago_with_tooltip(@build.created_at)}
          - if @build.finished_at
            %p
              %span.attr-name Finished:
              #{time_ago_with_tooltip(@build.finished_at)}
133
          %p
134 135 136 137 138
            %span.attr-name Runner:
            - if @build.runner && current_user && current_user.admin
              = link_to "##{@build.runner.id}", admin_runner_path(@build.runner.id)
            - elsif @build.runner
              \##{@build.runner.id}
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160

      - if @build.trigger_request
        .build-widget
          %h4.title
            Trigger

          %p
            %span.attr-name Token:
            #{@build.trigger_request.trigger.short_token}

          - if @build.trigger_request.variables
            %p
              %span.attr-name Variables:

            %code
              - @build.trigger_request.variables.each do |key, value|
                #{key}=#{value}

      .build-widget
        %h4.title
          Commit
          .pull-right
161
            %small
Kamil Trzcinski's avatar
Kamil Trzcinski committed
162
              = link_to @build.commit.short_sha, ci_status_path(@build.commit), class: "monospace"
163 164
        %p
          %span.attr-name Branch:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
165
          = link_to @build.ref, namespace_project_commits_path(@project.namespace, @project, @build.ref)
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
        %p
          %span.attr-name Author:
          #{@build.commit.git_author_name}
        %p
          %span.attr-name Message:
          #{@build.commit.git_commit_message}

      - if @build.tags.any?
        .build-widget
          %h4.title
            Tags
          - @build.tag_list.each do |tag|
            %span.label.label-primary
              = tag

      - if @builds.present?
        .build-widget
183
          %h4.title #{pluralize(@builds.count(:id), "other build")} for
Kamil Trzcinski's avatar
Kamil Trzcinski committed
184 185
          = succeed ":" do
            = link_to @build.commit.short_sha, ci_status_path(@build.commit), class: "monospace"
186 187 188 189 190 191
          %table.table.builds
            - @builds.each_with_index do |build, i|
              %tr.build
                %td
                  = ci_icon_for_status(build.status)
                %td
Andy Brandt's avatar
Andy Brandt committed
192
                  = link_to namespace_project_build_path(@project.namespace, @project, build) do
193 194 195 196 197 198 199 200 201
                    - if build.name
                      = build.name
                    - else
                      %span ##{build.id}

                %td.status= build.status


  :javascript
Kamil Trzcinski's avatar
Kamil Trzcinski committed
202
    new CiBuild("#{namespace_project_build_url(@project.namespace, @project, @build)}", "#{@build.status}")