Plugin development: Add automatic parameters

33 views
Skip to first unread message

David Campos

unread,
Mar 30, 2016, 12:07:01 PM3/30/16
to Jenkins Developers
Hi all,

I have started recently to develop a few plugins for Jenkins and I got stuck in something that I don't know if can be done or not.

The thing is that I want to add a custom set of parameters ("This build is parametrized") to all builds that are including my plugin. The reason why I want to do so is because the user of the plugin might need to input some data (files from and external server, uploaded or from another job) and I want those parameters to be provided on job trigger instead of on configuration. I know that I can provide parameters to achieve that but that requires all the jobs to be configured properly and manually (or with DSL).

Is it possible?

My workflow would be as follows:

The user configures the job to use my plugin -> The plugin adds a set of parameters to the job config -> The user runs the job providing the necessary parameters

Things that I have considered:

* Custom jelly page that has my custom fields. The cons of this solution is that then the plugin is not compatible with other sequential steps that work with user parameters.

Thanks for the answers and feel free to ask if something is confusing.

Robert Sandell

unread,
Mar 30, 2016, 12:28:25 PM3/30/16
to jenkin...@googlegroups.com
The normal way that plugins has solved this in the past is to ask the user that is configuring the job to add the parameters themselves and then either name the parameter something specific or be of a specific type or provide the name of the parameter to your plugin config.

But it is possible to add it programmaticly as well. You basically need to add or modify the ParametersDefinitionProperty in the job. But it would be hacky at best to get it there.

/B

--
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/e4a39b73-ce1a-4e0c-8a0b-6b64184f6f7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Robert Sandell
Software Engineer
CloudBees Inc.
Reply all
Reply to author
Forward
0 new messages