Maciek Sawicki
Maciek Sawicki

Reputation: 6835

Jenkins plugin - referring to global plugin settings in project plugin settings

I would like to wrote simple hudson plugin. I got stuck on one thing. I would like to be able to use global settings from global.jelly as defaults values for config.jelly.

Is it possible? How can I do this? One more thing - I'm going to have dynamic form in global.jelly (I will use <f:repeatable> tag).

Upvotes: 3

Views: 1970

Answers (1)

Jens Thee&#223;
Jens Thee&#223;

Reputation: 580

When the user submits the global configuration, configure(StaplerRequest req, JSONObject json) is called on your descriptor. Usually you extract your setting from the request and put it into a field in your descriptor, where it will be automatically persisted.

Now define a getter for the setting in your descriptor and use e.g. <f:textbox default="${descriptor.getSetting()}/> in the config.jelly to access the global setting.

Upvotes: 2

Related Questions