I have a pipeline compliant test
plugin.in a @databoundConstructor i have to pass an instance of another class
Input (consisting of n number of variables to be taken as input
)
@Symbol("forget")
@Extension
public class ForgetBuilder extends Builder implements SimpleBuildStep {
private final String what;
@CheckForNull
public String stuff;
public Boolean checkbox;
public Input Input;
@DataBoundConstructor
public ForgetBuilder(String what,String stuff,boolean checkbox, Input Input) {
this.what = what;
this.stuff=stuff;
this.checkbox=checkbox;
this.Input=Input;
}
public Input getInput() {
return Input;
}
public Boolean getCheckbox() {
return checkbox;
}
public String getWhat() {
return what;
}
@Nonnull
public String getStuff() {
return stuff == null ? DescriptorImpl.defaultStuff : stuff;
}
@Override
public void perform(Run build,
FilePath workspace,
Launcher launcher,
TaskListener listener) throws InterruptedException, IOException {
listener.getLogger().println("What was " + what + "?");
listener.getLogger().println("stuff was " + stuff + "?");
listener.getLogger().println("checkbox was " + checkbox + "?");
}
I an able to write the pipeline script by which i can pass the arguments like string ,boolean etc.But im not sure how to pass the instance of another class in script
//script works fine with primitive variable ,can any please help me in how to pass the instance of another class after setting it variable to the below script
step([$class: 'ForgetBuilder', what: 'first string arg', stuff: 'Secong string arg' ,checkbox:true])