Commit 2e9af7dc authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch 'coverage-badge-refactor' into 'master'

Pipeline helper method for Badge::Coverage::Report

See merge request gitlab-org/gitlab!46347
parents 071548ea f9c28fe4
......@@ -17,8 +17,6 @@ module Gitlab
key_width: opts[:key_width].to_i,
key_text: opts[:key_text]
}
@pipeline = @project.ci_pipelines.latest_successful_for_ref(@ref)
end
def entity
......@@ -42,14 +40,18 @@ module Gitlab
private
def pipeline
@pipeline ||= @project.ci_pipelines.latest_successful_for_ref(@ref)
end
# rubocop: disable CodeReuse/ActiveRecord
def raw_coverage
return unless @pipeline
return unless pipeline
if @job.blank?
@pipeline.coverage
pipeline.coverage
else
@pipeline.builds
pipeline.builds
.find_by(name: @job)
.try(:coverage)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment