Quantcast

The 'best' way to add options to the global config screen

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

The 'best' way to add options to the global config screen

Joris
Dear list,

How should I add some configuration options (some dynamically populated pulldowns) to the global configuration screen of Jenkins as a plugin? I know how to do this as a Builder Task plugin, but the sole purpose of this plugin would be to have options on the global configuration screen (to enable addition and removal of identities from an OS X Keychain).

I have found the jenkins.model.GlobalQuietPeriodConfiguration, but that seems to be integrated into Jenkins.java as well, so that got me slightly confused, since that supposedly will not work for a plugin.

I also found the jenkins.plugins.ui_samples on the javadoc, but I cannot figure out how I should work with them (like do I do something like mvn -cpu hpi:create but different? or what exactly do I do)

Any pointers would be greatly appreciated!

Joris
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: The 'best' way to add options to the global config screen

ffromm
Hi Joris,
 
you can take a look at the slave-setup-plugin. I use a list of setup config items that can be added to the global config. See https://github.com/jenkinsci/slave-setup-plugin. I hope this helps.
 
Frederik

2012/7/26 Joris <[hidden email]>
Dear list,

How should I add some configuration options (some dynamically populated pulldowns) to the global configuration screen of Jenkins as a plugin? I know how to do this as a Builder Task plugin, but the sole purpose of this plugin would be to have options on the global configuration screen (to enable addition and removal of identities from an OS X Keychain).

I have found the jenkins.model.GlobalQuietPeriodConfiguration, but that seems to be integrated into Jenkins.java as well, so that got me slightly confused, since that supposedly will not work for a plugin.

I also found the jenkins.plugins.ui_samples on the javadoc, but I cannot figure out how I should work with them (like do I do something like mvn -cpu hpi:create but different? or what exactly do I do)

Any pointers would be greatly appreciated!

Joris

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: The 'best' way to add options to the global config screen

Jesse Glick-4
On 07/26/2012 05:38 AM, Frederik Fromm wrote:
> slave-setup-plugin

Specifically: http://javadoc.jenkins-ci.org/jenkins/model/GlobalConfiguration.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: The 'best' way to add options to the global config screen

Joris
Thanks Jesse and Frederik, those tips helped a lot :) Together with the jelly docs generated with mvn site, I think I'll manage to get it working.

On Thu, Jul 26, 2012 at 4:07 PM, Jesse Glick <[hidden email]> wrote:
On 07/26/2012 05:38 AM, Frederik Fromm wrote:
slave-setup-plugin

Specifically: http://javadoc.jenkins-ci.org/jenkins/model/GlobalConfiguration.html

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: The 'best' way to add options to the global config screen

Joris
I managed to get something up and running, but I'm encountering some serious problems. I have a class extending GlobalConfiguration, but it does not react to doFillFieldNameItems() for dynamically filling a dropdown. I think it may be because GlobalConfiguration declares a final getDescriptor, and the  descriptor is the way those doFill...Items methods work. Could this indeed be the case? Testing on IRC with kinow and me did not give any solutions yet.

My code, should anyone be so kind to have a look is here: http://pastebin.com/X1GMjasz
And this is the associated jelly: http://pastebin.com/1998y0A9

Joris

On Thursday, July 26, 2012 4:10:51 PM UTC+2, Joris wrote:
Thanks Jesse and Frederik, those tips helped a lot :) Together with the jelly docs generated with mvn site, I think I'll manage to get it working.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: The 'best' way to add options to the global config screen

kinow
Hi Joris,

https://github.com/kinow/plugin-zsub

I couldn't get the doFill...Items method to work, so I used jelly + Java code to achieve similar behavior.

And if I recall correctly, you needed to upload a file too, so in the global configuration there is a file upload field, and some code in the server to handle that (copied from PluginManager :-). I received an exception after submitting the form, due to a problem with a Subversion field, but I believe this is happening because I messed too much while coding the plugin, but I'm sure you'll get the idea from this code ;-)

Hope that helps,
 

Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com


>________________________________
> From: Joris <[hidden email]>
>To: [hidden email]
>Sent: Friday, 27 July 2012 12:36 PM
>Subject: Re: The 'best' way to add options to the global config screen
>
>
>I managed to get something up and running, but I'm encountering some serious problems. I have a class extending GlobalConfiguration, but it does not react to doFillFieldNameItems() for dynamically filling a dropdown. I think it may be because GlobalConfiguration declares a final getDescriptor, and the  descriptor is the way those doFill...Items methods work. Could this indeed be the case? Testing on IRC with kinow and me did not give any solutions yet.
>
>
>My code, should anyone be so kind to have a look is here: http://pastebin.com/X1GMjasz
>And this is the associated jelly: http://pastebin.com/1998y0A9
>
>
>Joris
>
>
>On Thursday, July 26, 2012 4:10:51 PM UTC+2, Joris wrote:
>Thanks Jesse and Frederik, those tips helped a lot :) Together with the jelly docs generated with mvn site, I think I'll manage to get it working.
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: The 'best' way to add options to the global config screen

Joris
Hi Bruno and others,

I have tried your sample, and it has worked, but after copying it and modifying it, it now produces a very persistent error 500, and no matter what I do (mvn clean, deleting target and work myself, wiping the maven repository at ~/.m2/repository) it will not work.

If I try to save it, it seems to run though your configure() call no problem, but then after that it hits a snag somewhere and gives a 500, with this stacktrace [1].

Any input would be greatly appreciated.

Joris

[1] http://pastebin.com/4ur4ppHx

On Saturday, July 28, 2012 3:05:34 PM UTC+2, kinow wrote:
Hi Joris,

https://github.com/kinow/plugin-zsub

I couldn't get the doFill...Items method to work, so I used jelly + Java code to achieve similar behavior.

And if I recall correctly, you needed to upload a file too, so in the global configuration there is a file upload field, and some code in the server to handle that (copied from PluginManager :-). I received an exception after submitting the form, due to a problem with a Subversion field, but I believe this is happening because I messed too much while coding the plugin, but I'm sure you'll get the idea from this code ;-)

Hope that helps,
 

Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com

Loading...