plugin for code coverage diffs per pr

198 views
Skip to first unread message

Eugene Platonov

unread,
Jan 29, 2016, 2:21:04 PM1/29/16
to Jenkins Developers
Hi All,
i have setup process using GitHub pull request builder and Groovy Postbuild plugins which reports difference in code coverage per PR. For each github repository I use two jenkins jobs: 
first for periodically calculating coverage for main branch (e.g. master) and saving it to a file on jenkins master box
second one is a regular PR builder enabled build that collects coverage of merged build, reads main branch coverage from file saved in build 1 and reports diff back to github using ghprb's comment file. Here're my questions:
1. what's the easiest way to make this reusable? does it make sense to write a plugin? If so, how does one make a plugin that needs 2 jobs?
2. Is there a better/easier way to achieve same goal?

Any comments/suggestions/references are appreciated.

Thank you.

~
Eugene

Oliver Gondža

unread,
Jan 29, 2016, 2:25:14 PM1/29/16
to jenkin...@googlegroups.com
On 01/29/2016 08:21 PM, Eugene Platonov wrote:

> 2. Is there a better/easier way to achieve same goal?

The main point seem to be making PR-building plugin and
coverage-collecting one aware of each other. Then you can compare PR
build results with latest build based on master. Imho, this is a
reasonable feature for a single job.

--
oliver

Eugene Platonov

unread,
Jan 29, 2016, 4:08:05 PM1/29/16
to Jenkins Developers
Thanks Oliver.
Do you mean run coverage collection twice in same build? one for master and one for branch to be merged?
I was thinking on this approach, but it will take twice longer to finish. I went with two different builds to run coverage only once during PR and use pre-computed coverage from other build for the diff.
Or do i get it wrong?

Laurence Bordowitz

unread,
Jan 29, 2016, 4:41:28 PM1/29/16
to jenkin...@googlegroups.com
This sounds like Sputnik, which can easily be adapted to a Jenkins plugin.


Does this do what you're talking about? Or am I off-base?

-- Larry Bordowitz


--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/a33e9acc-0c22-4394-91ad-4e3949b7a5f0%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


Eugene Platonov

unread,
Jan 29, 2016, 4:52:50 PM1/29/16
to Jenkins Developers, lbord...@yahoo-inc.com
Thanks Larry,
i didn't see how sputnik can solve same thing. I need to show a difference in coverage between main branch and branch to be merged. Can sputnik do this?

Based on their readme
Static code review for your Gerrit and Stash patchsets. Runs Checkstyle, PMD, FindBugs, Scalastyle, CodeNarc, JSLint and Sonar for you! 
Sputnik is intended to run just after your Jenkins/CI server build. It should be executed in the root directory of the analyzed project to find files to analyze.

it can run bunch of static code analysis tools, not sure about coverage diff. Am i missing something? 

Oliver Gondža

unread,
Jan 30, 2016, 4:08:43 PM1/30/16
to jenkin...@googlegroups.com
On 01/29/2016 10:08 PM, Eugene Platonov wrote:
> Thanks Oliver.
> Do you mean run coverage collection twice in same build?

No, It depend on the way you build your pull requests, but there is a
way to use one job for both master branch and PRs. Every build would run
either master or a PR. In such case, the plugin should, for every PR
build, compare the coverage with the o latest master build.

--
oliver

Eugene Platonov

unread,
Jan 31, 2016, 8:21:39 PM1/31/16
to Jenkins Developers
Could you please give more details on how to do this? I'm not sure i totally understand
Thank you!
Reply all
Reply to author
Forward
0 new messages