Hints for Jenkins Plugin Development

74 views
Skip to first unread message

konrad

unread,
Feb 12, 2016, 9:52:34 AM2/12/16
to Jenkins Developers

I'm about to develop a plugin for Jenkins which should post some build artifacts of some builds of some jobs to an external service.

More specifically:

  • on a per-project basis, configure one or more files to be deployable/releasable and add some file specific properties that influence the HTTP post triggered later by the user
  • in the build details view (e.g. build #12), display a 'release file x', 'release file y' button for every configured file (similar location on the UI side like the 'keep this build forever' button)
  • then post this file to the service

Maybe someone who knows the plugin API a bit more than me can give me a hint on which extension points I'll need. Right know I am looking into the BuildWrapper for the per-job configuration and I think I'll need a customer Action which I register to the build details view, but I am not sure how to do that. I don't think I can use the ArtifactManager because it looks like this one automatically iterates over all archived files as a build step.

Thanks you :-)

domi

unread,
Feb 12, 2016, 10:05:21 AM2/12/16
to Jenkins Developers
Maybe worth to take a look at this: https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over
/Domi

--
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/b545ad1d-3b61-490a-93ec-991312cd3db2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

konrad

unread,
Mar 2, 2016, 10:08:03 AM3/2/16
to Jenkins Developers
Okay thanks so far @Dominik.

I am playing around with the JobProperty Extension point because I can easily add my own Action when I override the `getJobActions` method.

Just to clarify, this changes - as expected - this view:


I would like to have another action displayed in the details view of a specific build:


As the appropriate hudson model seems to be Run, I'd expect to find a RunProperty extension point or something along that name, but I couldn't find it. So the only way that comes to my mind is to register a RunListener and call run.addAction(...). Is that the right way or am I off track?


Daniel Beck

unread,
Mar 2, 2016, 12:46:48 PM3/2/16
to jenkin...@googlegroups.com

On 02.03.2016, at 16:08, 'konrad' via Jenkins Developers <jenkin...@googlegroups.com> wrote:

> As the appropriate hudson model seems to be Run, I'd expect to find a RunProperty extension point or something along that name, but I couldn't find it. So the only way that comes to my mind is to register a RunListener and call run.addAction(...). Is that the right way or am I off track?

If you have a JobProperty on the job, you can implement perform(…)[1] and add your action to the build[2].

1: http://javadoc.jenkins-ci.org/hudson/model/JobProperty.html#perform%28hudson.model.AbstractBuild,%20hudson.Launcher,%20hudson.model.BuildListener%29
2: http://javadoc.jenkins-ci.org/hudson/model/Run.html#addAction%28hudson.model.Action%29

Reply all
Reply to author
Forward
0 new messages