Jenkins post-build plugin development

I am currently developing a simple plugin that extracts results from a Jenkins build. I am extending Notifier and using build.getResults() to get the information. However, when I download my plugin, I cannot install it as an action after the build.
When I run my assemblies, they break into build.getResults() , since I'm trying to get the results while the assembly is still running.

What can I do to get the result of the assembly correctly?

+6
source share
3 answers

It’s best to look at existing plugins that use the Notifier extension point (click to expand the list of plugins).

Make sure you have the descriptor runtime class (internal) as well as config.jelly. Also check the jenkins.out and jenkins.err logs for any exceptions (e.g. malformed config.jelly).

Edit: in fact, the Notifier subclass of this plugin looks very simple, since Notifiers go: https://wiki.jenkins-ci.org/display/JENKINS/The+Continuous+Integration+Game+plugin , see in particular , its GamePublisher.java and the corresponding config.jelly , and GameDescriptor.java , which was made a complete external class (often a descriptor is an internal class). Also, if you need options in the Jenkins global configuration, you need global.jelly , but if you don't have such options, this is something you can simply refuse (unlike config.jelly, which you should have for Notifier, even if it is empty, like here).

As a general note, this can be very frustrating when something doesn't work and you don't get any error, your things just just don't show up by Jenkins ... If you just want to make things work for you, using the Groovy build step could be easier, but if you want to make the work work for others, then the implementation of a decent full plug-in reduces support requests.

+2
source

Since it sounds so simple, are you sure you need a plugin? Take a look at the Groovy post-file step ; they are much easier to write. There are some usage examples in the link. If you decide that you really need a plugin, see if you can expand the existing one, and not write your own; this is an easier way to understand the ins and outs of the Jenkins plugin.

+1
source

First of all, thanks for the great plugin. Secondly, I wonder how much time you guys will have to replace / add a “Script” with the option to select (one or more) “Build Steps”? IObit Driver Booster Our use case: in our current installation, our assembly nodes are Windows (.NET assembly) with Cygwin, so we can execute Shell scripts for them. For most plugins, we can choose the "Execute shell" build step, but the "Script" field of the Post Build Task plugin will be executed directly on any assembly node. Then we get cmd instead of bash.

Thank you

0
source

Source: https://habr.com/ru/post/927296/


All Articles