My instance is failing to start because Active Choice plugin is not CasC compatible

1 minute readKnowledge base

Issue

  • I have created some Jobs using the Active Choices plugin, and when importing to my CasC Bundle the generated yaml code from the export feature, my instance is not starting up, and the following logs are printed:

WARNING c.c.j.p.c.i.t.GenericModelObject#fromYaml: Property [script] in class [org.biouno.unochoice.ChoiceParameter] cannot be modelled. Reason: [Could not find a factory for groovyScript of class org.biouno.unochoice.model.Script]\ WARNING c.c.j.p.c.i.t.GenericModelObject#fromYaml: Property [parameterDefinitions] in class [hudson.model.ParametersDefinitionProperty] cannot be modelled. Reason: [Could not find a factory for groovyScript of class org.biouno.unochoice.model.Script]\ SEVERE jenkins.InitReactorRunner$1#onTaskFailed: Failed Bootstrap.initialize\ com.cloudbees.jenkins.plugins.casc.CasCException: Could not find a factory for groovyScript of class org.biouno.unochoice.model.Script\ at com.cloudbees.jenkins.plugins.casc.items.types.ReflectionHelper.processMap(ReflectionHelper.java:978)\ at com.cloudbees.jenkins.plugins.casc.items.types.ReflectionHelper.fromYamlToModel(ReflectionHelper.java:950)\ [...] SEVERE hudson.util.BootFailure#publish: Failed to initialize Jenkins\ com.cloudbees.jenkins.plugins.casc.CasCException: Could not find a factory for groovyScript of class org.biouno.unochoice.model.Script\ at com.cloudbees.jenkins.plugins.casc.items.types.ReflectionHelper.processMap(ReflectionHelper.java:978)\ at com.cloudbees.jenkins.plugins.casc.items.types.ReflectionHelper.fromYamlToModel(ReflectionHelper.java:950)\ [...]

Resolution

The problem is that CasC can’t find a valid descriptor for the script nor for the parameterDefinitions properties: script and parameterDefinitions are serializable, but the interfaces are not describable. To be CasC compatible, the Active Choices plugin maintainers have to implement the specific requirement. In the meantime, this means those Active Choices elements can’t be imported into the CasC Bundles, and in order to fix the issue, you should remove the definition parameterDefinitions from your items.yaml file that is populated by the aforementioned plugin.

properties: - parameters: parameterDefinitions: