-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
It's possible for external automation systems to use the REST API to create new agent configurations. Unfortunately, they cannot choose the OnceRetentionStrategy because it has no DataBoundConstructor:
org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.jenkinsci.plugins.durabletask.executors.OnceRetentionStrategy at org.kohsuke.stapler.ClassDescriptor.loadConstructorParamNames(ClassDescriptor.java:291) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:983) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:874) Caused: java.lang.IllegalArgumentException: Failed to instantiate class hudson.slaves.RetentionStrategy from {"stapler-class":"org.jenkinsci.plugins.durabletask.executors.OnceRetentionStrategy"}
Here's the code:
Can anyone familiar with this code indicate if there are any barriers or complications to adding a DataBoundConstructor to it? It seems likely there's a reason it wasn't included by default.
Assuming adding it is not an option, would it be reasonable within DurableTask to expose a new OnceRetentionStrategy class which is bindable for such use cases?