GitHub Pull Request Coverage Status Plugin for Jenkins
Overview
https://wiki.jenkins-ci.org/display/JENKINS/GitHub+PR+Coverage+Status+Plugin
Parse code coverage report generated by build and post code coverage status comment to GitHub pull request:
Supports coverage reports
- Jacoco
jacoco.xml
- Cobertura
cobertura.xml
orcobertura-coverage.xml
- Clover
clover.xml
- SimpleCov JSON (Ruby)
coverage.json
How to use
- Select or create new Jenkins build
- Ensure that build create code coverage report file
- Configure build to be triggered by GitHub pull request builder plugin
- Install plugin from Jenkins Plugin Repository
- Or manually
- Goto releases
- Download latest version of plugin .hpi file
- Install to your Jenkins guide
- Configure global settings of plugin
- GitHub API URL keep blank for GitHub.com and fill if for dedicated instance of GitHub, example:
http(s)://hostname/api/v3/
- Set Personal Access Token (or keep blank if anonymous access enabled)
- [Optional] Add Record Master Coverage post build step to build which test your master
- Add Publish coverage to GitHub post build step to build. It should be triggered by GitHub pull request builder plugin
Troubleshooting
No coverage picture and my Jenkins is in private network and not accessible for GitHub
Because of that GitHub can't render icon picture hosted on Jenkins. Plugin can use http://shields.io public resource instead of Jenkins hosted picture. To use it:
- Goto
Jenkins Configuration
- Turn on
Jenkins is not accessible for GitHub
- Done next coverage comment in Pull Request will use http://shields.io
No coverage picture on GitHub Pull Request Page
If you see next picture on your pull request in GitHub:
In most cases that mean that your Jenkins runs on http
instead of https
Plugin uses same protocol as your Jenkins, however GitHub in most cases accessible by https
Default browser policy to block non secure resources on secure pages from unknown domain.
To fix that:
- Configure Jenkins to be accessible for
https
https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins - 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 GitHub Pull Requests
- Find property
Jenkins URL for icon in Pull Request
- Put URL to your Jenkins with
https
likehttps://jenkins.my.com
- Save
- Find section
- Restart Jenkins
Changelog
1.4.0
Supporting of private Jenkins with public GitHub. To enable that mode goto Jenkins Configuration and turn on Jenkins is not accessible for GitHub
1.3.0
Add support SimpleCov JSON coverage report for Ruby
1.2.0
Add alternative text to coverage image for case when GitHub 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