Missing required parameters in Pipeline

Hi,

I have the Plugin below written to have the function signature getting all params as flat.

This creates an issue when users are trying to generate the syntax when some attributes are residing within an optional Jelly block (they don’t appear in the syntax if the optional block was not selected), but in any case its an error prone activity because the way the plugin was written.

(vmanager-plugin/src/main/java/org/jenkinsci/plugins/vmanager/dsl/VMGRLaunchStep.java at b72ab3b9dc23de0d848436e57dfd20874992ef80 · jenkinsci/vmanager-plugin · GitHub)

Question is what options do I have to overcome this, without breaking the backward compatibility. I suppose I can add yet another constructors to covers those signature possibilities, but that seems too cumbersome overall.

Is there any workaround to it?

Thanks,

Tal.

You can use the databoundsetter annotation. It specifically is designed to avoid the creep of arguments to constructor.

I’m mobile so it’s hard to find examples

1 Like

Thanks Gavin,

I read here Writing Pipeline-Compatible Plugins about it, and I used @deprecated on the old constructor that seems to solve my issue.

Thanks a lot,

Tal.

1 Like