TouK / sputnik

Static code review for your Gerrit patchsets. Runs Checkstyle, PMD, FindBugs, Scalastyle, CodeNarc, JSLint for you!
Apache License 2.0
201 stars 117 forks source link

Would you please implement Jenkins/Hudson plugin? #79

Open eagleliang opened 9 years ago

eagleliang commented 9 years ago

It would be a greater thing if implement as a jenkins plugin, and provide the way to config on jenkins UI.

Current configuration is a bit complex and confusing. E.g, the path of check rule (like checkstyle config file) should be absolute path,Or,sputnik always throw following exception when running on jenkins/hudson, even if you can run successfully on local with the same configuration.

17:13:47.899 [main] ERROR pl.touk.sputnik.engine.ReviewRunner - Processor Checkstyle error
pl.touk.sputnik.review.ReviewException: Unable to create Checkstyle checker
    at pl.touk.sputnik.processor.checkstyle.CheckstyleProcessor.createChecker(CheckstyleProcessor.java:61) ~[sputnik-1.4.0.jar:1.4.0]
    at pl.touk.sputnik.processor.checkstyle.CheckstyleProcessor.innerProcess(CheckstyleProcessor.java:44) ~[sputnik-1.4.0.jar:1.4.0]
    at pl.touk.sputnik.processor.checkstyle.CheckstyleProcessor.process(CheckstyleProcessor.java:32) ~[sputnik-1.4.0.jar:1.4.0]
    at pl.touk.sputnik.engine.ReviewRunner.review(ReviewRunner.java:24) ~[sputnik-1.4.0.jar:1.4.0]
    at pl.touk.sputnik.engine.Engine.run(Engine.java:33) [sputnik-1.4.0.jar:1.4.0]
    at pl.touk.sputnik.Main.main(Main.java:37) [sputnik-1.4.0.jar:1.4.0]
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: unable to find android_checks.xml
    at com.puppycrawl.tools.checkstyle.ConfigurationLoader.loadConfiguration(ConfigurationLoader.java:342) ~[checkstyle-6.1.jar:6.1]
    at com.puppycrawl.tools.checkstyle.ConfigurationLoader.loadConfiguration(ConfigurationLoader.java:286) ~[checkstyle-6.1.jar:6.1]
    at pl.touk.sputnik.processor.checkstyle.CheckstyleProcessor.createChecker(CheckstyleProcessor.java:57) ~[sputnik-1.4.0.jar:1.4.0]
    ... 5 common frames omitted
Caused by: java.io.FileNotFoundException: android_checks.xml
    at com.puppycrawl.tools.checkstyle.ConfigurationLoader.loadConfiguration(ConfigurationLoader.java:328) ~[checkstyle-6.1.jar:6.1]
    ... 7 common frames omitted
17:13:47.906 [main] INFO  pl.touk.sputnik.engine.ReviewRunner - Review finished for processor Checkstyle. Took 0 s
17:13:47.906 [main] WARN  pl.touk.sputnik.engine.ReviewRunner - Review for processor Checkstyle returned empty review
SpOOnman commented 9 years ago

I didn't write any Jenkins plugin yet. Do you have some experience with that and want to contribute?

JKrag commented 9 years ago

If I can find the time, in the near future, I might actually try to give this a shot, because I also think that it might be a cool plugin to have. I don't know if it is desirable to turn Sputnik into a Jenkins plugin. The correct approach would probably be to write a stand-alone Sputnik-plugin that uses the existing sputnik, without adding Jenkins dependencies to Sputnik.

@eagleliang Maybe you could provide some input on how you image the plugin should work? Should it provide the full config in the Jenkins UI ("replacing" the sputnik properties file?) or should it just be a lightweight approach where you can configure the name and path to the properties file (if not default)

Note: I can't promise that I will be able to make this, or when, but I hope, and the discussion is relevant either way, if anyone is going to do it at some point.

eagleliang commented 9 years ago

If I can find the time, I'm glad to contribute. But I didn't make any Jenkins plugin neither.

@JKrag in my image:

lbordowitz commented 9 years ago

Is there any other reason that this has to be a post-build step OTHER than to support FindBugs? Why not do runtime java compilation?

I've written a Jenkins plugin before, and I've worked on one other. The actual configuration would be pretty simple, plus it would solve the plaintext credential issue (my biggest pet-peeve with sputnik).

SpOOnman commented 9 years ago

There is no reason that is needs to be post build action. I know at least two projects, where Sputnik is pre-build action and it works great for them.