BigW Consortium Gitlab

show.html.haml 8.04 KB
Newer Older
1
- page_title "#{@build.name} (##{@build.id})", "Builds"
Kamil Trzcinski committed
2
= render "header_title"
3
- trace_with_state = @build.trace_with_state
Kamil Trzcinski committed
4

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

  #up-build-trace
17
  - builds = @build.commit.builds.latest.to_a
18
  - if builds.size > 1
19
    %ul.nav-links.no-top.no-bottom
20
      - builds.each do |build|
21 22 23 24 25 26 27 28 29
        %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 committed
30
      - if @build.retried?
31 32 33 34
        %li.active
          %a
            Build ##{@build.id}
            ·
Kamil Trzcinski committed
35
            %i.fa.fa-warning
36 37
            This build was retried.

38
  .row-content-block.middle-block
39 40 41 42 43 44 45 46
    .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 committed
47
          #{time_ago_with_tooltip(@build.finished_at) if @build.finished_at}
48

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

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

68 69 70 71 72 73 74
  .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
75
      #js-build-scroll.scroll-controls
76 77 78 79 80
        = 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

81 82
      - if @build.erased?
        .erased.alert.alert-warning
83 84
          - erased_by = "by #{link_to @build.erased_by.name, user_path(@build.erased_by)}" if @build.erased_by
          Build has been erased #{erased_by.html_safe} #{time_ago_with_tooltip(@build.erased_at)}
85
      - else
86 87 88
        %pre.trace#build-trace
          %code.bash
            = preserve do
89
              = raw trace_with_state[:html]
90 91
              - if @build.active?
                %i{:class => "fa fa-refresh fa-spin"}
92

93 94 95 96 97 98 99 100 101
      %div#down-build-trace

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

102
      - if can?(current_user, :read_build, @project) && @build.artifacts?
103 104 105 106
        .build-widget.artifacts
          %h4.title Build artifacts
          .center
            .btn-group{ role: :group }
107
              = link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-primary' do
108 109 110
                = icon('download')
                Download

111
              - if @build.artifacts_metadata?
112
                = link_to browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-primary' do
113 114
                  = icon('folder-open')
                  Browse
115

116
      .build-widget.build-controls
117
        %h4.title
Kamil Trzcinski committed
118
          Build ##{@build.id}
119
          - if can?(current_user, :update_build, @project)
120 121
            .center
              .btn-group{ role: :group }
122 123 124 125
                - if @build.active?
                  = link_to "Cancel", cancel_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-danger', method: :post
                - elsif @build.retryable?
                  = link_to "Retry", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-primary', method: :post
126

127 128
                - if @build.erasable?
                  = link_to erase_namespace_project_build_path(@project.namespace, @project, @build),
129
                            class: 'btn btn-sm btn-warning', method: :post,
130 131 132
                            data: { confirm: 'Are you sure you want to erase this build?' } do
                    = icon('eraser')
                    Erase
133 134 135
                - if @build.has_trace?
                  = link_to 'Raw', raw_namespace_project_build_path(@project.namespace, @project, @build),
                            class: 'btn btn-sm btn-success', target: '_blank'
136 137 138 139 140 141

        .clearfix
          - if @build.duration
            %p
              %span.attr-name Duration:
              #{duration_in_words(@build.finished_at, @build.started_at)}
142
          %p
143 144 145 146 147 148
            %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)}
149 150 151 152
          - if @build.erased_at
            %p
              %span.attr-name Erased:
              #{time_ago_with_tooltip(@build.erased_at)}
153
          %p
154 155 156 157 158
            %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}
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180

      - 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
181
            %small
Kamil Trzcinski committed
182
              = link_to @build.commit.short_sha, ci_status_path(@build.commit), class: "monospace"
183 184
        %p
          %span.attr-name Branch:
Kamil Trzcinski committed
185
          = link_to @build.ref, namespace_project_commits_path(@project.namespace, @project, @build.ref)
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
        %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
203
          %h4.title #{pluralize(@builds.count(:id), "other build")} for
Kamil Trzcinski committed
204 205
          = succeed ":" do
            = link_to @build.commit.short_sha, ci_status_path(@build.commit), class: "monospace"
206 207 208 209 210 211
          %table.table.builds
            - @builds.each_with_index do |build, i|
              %tr.build
                %td
                  = ci_icon_for_status(build.status)
                %td
Andy Brandt committed
212
                  = link_to namespace_project_build_path(@project.namespace, @project, build) do
213 214 215 216 217 218 219 220 221
                    - if build.name
                      = build.name
                    - else
                      %span ##{build.id}

                %td.status= build.status


  :javascript
222
    new CiBuild("#{namespace_project_build_url(@project.namespace, @project, @build)}", "#{@build.status}", "#{trace_with_state[:state]}")