I've determined that the cause of my issue was a missing variable
declaration in my index.jelly template to set the instance and
descriptor variables before my <f:select /> item.
I've been able to get the parameter setting portion of the plugin
working though it seems that the way I have to get from the
doFillValueItems method in my descriptor back to the instance of my
parameter definition is not optimal. It also leads to a condition
where I'm not able to have more than one of my dynamic parameters in a
configuration screen because I can't distinguish which instance to
pull the configuration from.
I'm doing the following to get the parameter definition from within my
doFillValueItems method, is there a better way?
String containsJobName = getCurrentDescriptorByNameUrl();
String jobName =
java.net.URLDecoder.decode(containsJobName.substring(containsJobName.lastIndexOf("/")
+ 1));
Job<?,?> j = Hudson.getInstance().getItemByFullName(jobName,
hudson.model.Job.class);
if (j != null) {
ParametersDefinitionProperty pdp =
j.getProperty(hudson.model.ParametersDefinitionProperty.class);
List<ParameterDefinition> pds = pdp.getParameterDefinitions();
for (ParameterDefinition pd : pds) {
if (this.isInstance(pd)) {
return (DynamicParameter) pd;
}
}
}
I can add some hidden variables and get them passed as a query
parameter to my doFillValueItems method to help alleviate the problem
of only being able to use one of my type of parameter but I think if
someone can show me a better way to get back to the instance from the
descriptor that problem may go away.
The latest code has been committed and pushed to
https://github.com/tekante/Dynamic-Jenkins-Parameter
Thanks,
Chris