jenkinsci / rubymetrics-plugin

Ruby metric reports for Jenkins. Rcov, Rails stats, Rails notes and Flog.
https://plugins.jenkins.io/rubyMetrics/
25 stars 28 forks source link

Add support for Pipeline jobs #28

Closed md5 closed 7 years ago

md5 commented 7 years ago

This PR updates this plugin to work correctly with pipeline jobs.

The main change is to change references to AbstractProject, AbstractBuild, and BuildListener to refer to Job, Run, and TaskListener respectively. Another change is to implement SimpleBuildStep.LastBuildAction to allow build actions to contribute actions to a project.

One thing I did not do was to make this plugin actually depend on the Pipeline API, so in order to use the publishers, you'll need to use the step metastep. Here's an example for RcovPublisher:

step([
    $class: 'RcovPublisher',
    reportDir: "coverage/rcov",
    targets: [
        [metric: "CODE_COVERAGE", healthy: 75, unhealthy: 50, unstable: 30]
    ]
])

Many thanks to @SuperTux88 for starting this work in https://github.com/jenkinsci/rubymetrics-plugin/commit/61f5f2ad69c284e89e7d04660fb6365ddc780eb3 and to @cprice404 for his helpful guide to refactoring Jenkins plugins to be pipeline-compatible: https://jenkins.io/blog/2016/05/25/update-plugin-for-pipeline/

md5 commented 7 years ago

Another thing I didn't do in this PR was to update the generator code under src/main/ruby to reflect the change to use SimpleBuildStep.LastBuildAction.

md5 commented 7 years ago

:metal:

pkuczynski commented 7 years ago

So I was finally able to deploy your PR into version 1.6.4. Took a while :)

As it turns out latest jenkins plugin requirements include FindBugs to pass, which in our case shows 31 errors. I silenced it for now and created #30. Unfortunately I am not a Java developer so I am not really able to fix this issues. Maybe you would like to help?

tintht commented 7 years ago

Awesome when to know RubyMetrics-Plugin could work with pipeline but why you don't update how-to-work from readme.md, im lucky when reading changelog.md to know it could work with pipeline :)

BTW, thank you for this plugin.