adiesner / bitbucket-pr-coverage-status-plugin

Apache License 2.0
4 stars 4 forks source link

Bitbucket/Stash Pull Request Coverage Status Plugin for Jenkins

Build Status codecov

Overview

Parse code coverage report generated by build and post code coverage status comment to Bitbucket pull request: Example

Supports coverage reports

How to use

Install Plugin

Configure master/reference coverage source

To be able compare Pull Request coverage plugin needs master/reference coverage for Bitbucket repository.

Jenkins build

Sonar

You have the option to get the master coverage (base coverage) from your SonarQube instance. Otherwise the plugin will keep track of the master coverage in the project configuration file.

The plugin will try to find the project in SonarQube based on the repository name. If more than one projects match, a warning is logged, and the first one will be used to get the coverage data.

Publish coverage for pull request

Depends on plugin which you are using to run (trigger) pull request in Jenkins.

Stash Pull Request Builder Plugin

Branch API Plugin

Other

How to use with Jenkins Pipelines

Troubleshooting

No coverage picture and my Jenkins is in private network and not accessible for Bitbucket

Because of that Bitbucket can't render icon picture hosted on Jenkins. Plugin can use http://shields.io public resource instead of Jenkins hosted picture. To use it:

No coverage picture on Bitbucket Pull Request Page

If you see next picture on your pull request in Bitbucket:

No coverage picture

In most cases that mean that your Jenkins runs on http instead of https Plugin uses same protocol as your Jenkins, however Bitbucket in most cases accessible by https Default browser policy to block non secure resources on secure pages from unknown domain.

To fix that:

  1. Configure Jenkins to be accessible for https https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins
  2. Next you have a few options:
    • Run your Jenkins on https only
    • Or configure plugin to publish link on picture over https
    • Open Jenkins
    • Click Manage Jenkins
    • Click Configure System
      • Find section Coverage status for Bitbucket Pull Requests
      • Find property Jenkins URL for icon in Pull Request
      • Put URL to your Jenkins with https like https://jenkins.my.com
      • Save
    • Restart Jenkins

Plugin settings

Changelog

0.0.1

1.9.1

1.9.0

1.8.2

1.8.0

1.7.1

1.7.0

1.6.1

1.6.0

1.5.0

Supporting Master Coverage from SonarQube. Check (details)[#master-coverage-from-sonar]

1.4.0

Supporting of private Jenkins with public Bitbucket. To enable that mode goto Jenkins Configuration and turn on Jenkins is not accessible for Bitbucket

1.3.0

Add support SimpleCov JSON coverage report for Ruby

1.2.0

Add alternative text to coverage image for case when Bitbucket doesn't able to show image

1.1.1

Correct parsing Cobertura report for edge cases

1.0.8

First public release to Jenkins Plugin Repo