Hi, I am developing a plugin in which I want to create a BuildStep. From UI perspective, the user should be able to select a certain script to run (A,B,C). The scripts have some common parameters (i.e: debug mode, version to use, etc...) and then some specific ones.
I have seen the ui-samples-plugin <https://github.com/jenkinsci/ui-samples-plugin>, in particular the DropdownList example, which has a base class Fruit and then some child classes with particular configurable parameters (Apple, Banana), which fits exactly my use case. However, I am struggling to implement this same behavior when it comes to my plugin. I am starting from the HelloWorldBuilder archetype. I added to the HelloWorldBuilder class the definition of the Fruit, Apple, and Banana classes, as well as the FruitDescriptor. The first issue that I am facing is that in the config.jelly associated to the HelloWorldBuilder, the "${it}" object, is not an instance of the the HelloWorldBuilder class, instead, it is an instance of the FreeStyleProject class. <j:forEach var="descriptor" items="${it.fruitDescriptors}" varStatus="loop"> <https://github.com/jenkinsci/ui-samples-plugin/blob/master/src/main/resources/jenkins/plugins/ui_samples/DropdownList/index.jelly#L34> I have seen that a different type of object can be referenced, which is the ${instance}. I have tried by modifying the references to ${it} and replace them by ${instance}. In this case, it does refer to the HelloWorldBuilder class, but, this object is null when adding the build step into a job for the first time. Once I save the job and re-configure, the drop-down list is populated, since the instance is created. But then again, I face another problem, the data does not seem to be persisted, I have debugged and indeed the DataBoundConstructor for HelloWorldBuilder is invoked and the Fruit object is passed to it, but in further re-configurations of the job step, it is not persisted. I wonder if someone can provide some guidance here. I have tried to search for other plugins that may implement similar patterns but couldn't really found simple examples of it that I could somehow re-use as part of this plugin. The most similar scenario I have seen is the warnings-ng-plugin <https://github.com/jenkinsci/warnings-ng-plugin>. But it is quite complex and I haven't been able to fully understand it. Thanks anyways for the community help & support. BRs /Iván -- 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-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/56e3c975-3920-4eb6-ab03-1fc12b05231bn%40googlegroups.com.