On Wednesday, 10 April 2019 09:44:31 UTC+5:30, touseef wrote:
>
> 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])
>
*I figured it out.Posting the solution*
* step([$class: 'ForgetBuilder', what: 'first string arg', stuff:
'Secong string arg' ,checkbox:true,Input: [$class:
'Input',ideSelectionToUse:"value from instance class"]]) *
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/e2426331-1417-41de-9720-b3290f6b19d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.