summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-08-19 15:22:54 +0000
committerDouwe Maan <douwe@gitlab.com>2016-08-19 15:22:54 +0000
commitd2f4c3ca5de33f437a6c3c8a51474190b431fb0b (patch)
tree28f76358df6514a547cc32b25ffa270550857c84 /lib
parentd0e77fb50d0c64d0c8f9c06f915aa883e8dfd9cb (diff)
parent8527f3fa4641cee3c56e8eef7c07efc06aa7bdc5 (diff)
downloadgitlab-ce-d2f4c3ca5de33f437a6c3c8a51474190b431fb0b.tar.gz
Merge branch 'fix/improve-test-coverage-badge-pipelines' into 'master'
Render coverage badge using latest successful pipeline ## What does this MR do? This MR make test coverage badge to report value for the latest successful pipeline, instead of the latest one, regardless the status. Latest pipeline is often running, which makes coverage report inaccurate. Latest pipeline can be also the failed one, which may mean that not all stages got processed, therefore coverage report can be inaccurate as well. This also improves coverage badge performance because it is not necessary to touch repository to get recent SHA on the branch. ## Why was this MR needed? See #21013 ## What are the relevant issue numbers? Closes #21013 ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5862
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/badge/coverage/report.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/gitlab/badge/coverage/report.rb b/lib/gitlab/badge/coverage/report.rb
index 3d56ea3e47a..95d925dc7f3 100644
--- a/lib/gitlab/badge/coverage/report.rb
+++ b/lib/gitlab/badge/coverage/report.rb
@@ -13,8 +13,7 @@ module Gitlab
@job = job
@pipeline = @project.pipelines
- .where(ref: @ref)
- .where(sha: @project.commit(@ref).try(:sha))
+ .latest_successful_for(@ref)
.first
end