summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-03-31 16:30:08 +0200
committerToon Claes <toon@gitlab.com>2017-04-06 11:38:23 +0200
commit0ec3a031f4a8f392b9d79c4b638d832b1e077718 (patch)
treeb0832efa9b8e3ebbe624f3df9f0c1773e025a51b
parent49bdd8d63b577f079cdc47f7dd10ba83c677771a (diff)
downloadgitlab-ce-tc-show-pipeline-coverage-if-avail.tar.gz
Show the test coverage if it is availabletc-show-pipeline-coverage-if-avail
Do not check if coverage is enabled, just show it when it is available.
-rwxr-xr-xapp/controllers/projects/merge_requests_controller.rb2
-rw-r--r--app/models/project.rb4
-rw-r--r--app/views/projects/builds/_table.html.haml2
-rw-r--r--app/views/projects/ci/builds/_build.html.haml3
-rw-r--r--app/views/projects/commit/_pipeline.html.haml3
-rw-r--r--app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml3
-rw-r--r--app/views/projects/pipelines/_with_tabs.html.haml3
-rw-r--r--app/views/projects/stage/_stage.html.haml4
-rw-r--r--changelogs/unreleased/tc-show-pipeline-coverage-if-avail.yml4
9 files changed, 12 insertions, 16 deletions
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index a79d801991a..c337534b297 100755
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -452,7 +452,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
if pipeline
status = pipeline.status
- coverage = pipeline.try(:coverage)
+ coverage = pipeline.coverage
status = "success_with_warnings" if pipeline.success? && pipeline.has_warnings?
diff --git a/app/models/project.rb b/app/models/project.rb
index 12fd0668ff8..2695cb1fb93 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1110,10 +1110,6 @@ class Project < ActiveRecord::Base
self.runners_token && ActiveSupport::SecurityUtils.variable_size_secure_compare(token, self.runners_token)
end
- def build_coverage_enabled?
- build_coverage_regex.present?
- end
-
def build_timeout_in_minutes
build_timeout / 60
end
diff --git a/app/views/projects/builds/_table.html.haml b/app/views/projects/builds/_table.html.haml
index acfdb250aff..82806f022ee 100644
--- a/app/views/projects/builds/_table.html.haml
+++ b/app/views/projects/builds/_table.html.haml
@@ -20,6 +20,6 @@
%th Coverage
%th
- = render partial: "projects/ci/builds/build", collection: builds, as: :build, locals: { commit_sha: true, ref: true, pipeline_link: true, stage: true, allow_retry: true, coverage: admin || project.build_coverage_enabled?, admin: admin }
+ = render partial: "projects/ci/builds/build", collection: builds, as: :build, locals: { commit_sha: true, ref: true, pipeline_link: true, stage: true, allow_retry: true, admin: admin }
= paginate builds, theme: 'gitlab'
diff --git a/app/views/projects/ci/builds/_build.html.haml b/app/views/projects/ci/builds/_build.html.haml
index aeed293a724..508465cbfb7 100644
--- a/app/views/projects/ci/builds/_build.html.haml
+++ b/app/views/projects/ci/builds/_build.html.haml
@@ -4,7 +4,6 @@
- retried = local_assigns.fetch(:retried, false)
- pipeline_link = local_assigns.fetch(:pipeline_link, false)
- stage = local_assigns.fetch(:stage, false)
-- coverage = local_assigns.fetch(:coverage, false)
- allow_retry = local_assigns.fetch(:allow_retry, false)
%tr.build.commit{ class: ('retried' if retried) }
@@ -88,7 +87,7 @@
%span= time_ago_with_tooltip(build.finished_at)
%td.coverage
- - if coverage && build.try(:coverage)
+ - if build.try(:coverage)
#{build.coverage}%
%td
diff --git a/app/views/projects/commit/_pipeline.html.haml b/app/views/projects/commit/_pipeline.html.haml
index c2b32a22170..3ee85723ebe 100644
--- a/app/views/projects/commit/_pipeline.html.haml
+++ b/app/views/projects/commit/_pipeline.html.haml
@@ -47,7 +47,6 @@
%th Job ID
%th Name
%th
- - if pipeline.project.build_coverage_enabled?
- %th Coverage
+ %th Coverage
%th
= render partial: "projects/stage/stage", collection: pipeline.stages, as: :stage
diff --git a/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml b/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml
index 07fb80750d6..f458646522c 100644
--- a/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml
+++ b/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml
@@ -4,7 +4,6 @@
- retried = local_assigns.fetch(:retried, false)
- pipeline_link = local_assigns.fetch(:pipeline_link, false)
- stage = local_assigns.fetch(:stage, false)
-- coverage = local_assigns.fetch(:coverage, false)
%tr.generic_commit_status{ class: ('retried' if retried) }
%td.status
@@ -80,7 +79,7 @@
%span= time_ago_with_tooltip(generic_commit_status.finished_at)
%td.coverage
- - if coverage && generic_commit_status.try(:coverage)
+ - if generic_commit_status.try(:coverage)
#{generic_commit_status.coverage}%
%td
diff --git a/app/views/projects/pipelines/_with_tabs.html.haml b/app/views/projects/pipelines/_with_tabs.html.haml
index 53067cdcba4..d7cefb8613e 100644
--- a/app/views/projects/pipelines/_with_tabs.html.haml
+++ b/app/views/projects/pipelines/_with_tabs.html.haml
@@ -36,7 +36,6 @@
%th Job ID
%th Name
%th
- - if pipeline.project.build_coverage_enabled?
- %th Coverage
+ %th Coverage
%th
= render partial: "projects/stage/stage", collection: pipeline.stages, as: :stage
diff --git a/app/views/projects/stage/_stage.html.haml b/app/views/projects/stage/_stage.html.haml
index 28e1c060875..f93994bebe3 100644
--- a/app/views/projects/stage/_stage.html.haml
+++ b/app/views/projects/stage/_stage.html.haml
@@ -6,8 +6,8 @@
= ci_icon_for_status(stage.status)
&nbsp;
= stage.name.titleize
-= render stage.statuses.latest_ordered, coverage: @project.build_coverage_enabled?, stage: false, ref: false, pipeline_link: false, allow_retry: true
-= render stage.statuses.retried_ordered, coverage: @project.build_coverage_enabled?, stage: false, ref: false, pipeline_link: false, retried: true
+= render stage.statuses.latest_ordered, stage: false, ref: false, pipeline_link: false, allow_retry: true
+= render stage.statuses.retried_ordered, stage: false, ref: false, pipeline_link: false, retried: true
%tr
%td{ colspan: 10 }
&nbsp;
diff --git a/changelogs/unreleased/tc-show-pipeline-coverage-if-avail.yml b/changelogs/unreleased/tc-show-pipeline-coverage-if-avail.yml
new file mode 100644
index 00000000000..c0cc4fb18c8
--- /dev/null
+++ b/changelogs/unreleased/tc-show-pipeline-coverage-if-avail.yml
@@ -0,0 +1,4 @@
+---
+title: Show the build/pipeline coverage if it is available
+merge_request:
+author: