Or even simpler: can't you just obtain the instance of the first builder using 
the API?

Ulli

Am 26.02.2013 um 17:40 schrieb Vincent Latombe <[email protected]>:

> Hi,
> 
> you can attach an Action object to the build in the first buildstep with the 
> data that you need to share, then retrieve it in the second buildstep.
> 
> Hope this helps,
> 
> 
> Vincent
> 
> 
> 2013/2/26 Stéphane Bruckert <[email protected]>
> Hello,
> 
> I'm developing two builders:
> - the first one is a buildstep that I run before SCM runs (using the 
> preSCMbuildstep plugin),
> - the second one is also a buildstep that I run as a normal buildstep (is ran 
> after the SCM).
> 
> In the first Builder, I let the user select a value from a list (I generate 
> the list myself from my own JAVA classes, which is why I can't use the 
> EnvInject plugin).
> 
> In the second Builder, I want to get the previously gotten value. Fore sure, 
> this value is stored in the config.xml of the job:
> 
> <buildWrappers>
>   <org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper 
> plugin="[email protected]">
>     <buildSteps>
>       <com.NameOfMyBuilder plugin="[email protected]">
>         <myValue>The value I want to get from the second builder</path>
>       </com.NameOfMyBuilder>
>     </buildSteps>
>   </org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper> 
> </buildWrappers>
> 
> It looks like there isn't any purely JAVA solution, like a Jenkins method, 
> that would let me get this value. I ended up with a working solution which 
> parses theconfig.xml this way:
> 
> config = new File(envVars.get("WORKSPACE") + File.separator + ".." + 
> File.separator + "config.xml");
> if (config.exists() && config.isFile()) {
>       try {
>               document = reader.read(config);
>       } catch [...]
> }
> if(document != null){
>       Node node = document.selectSingleNode("//com.NameOfMyBuilder/myValue");
>       String myValue = node.getText();
>       [...]
> }
> 
> Even if it works, I don't like this workaround. This is why I'm asking 
> whether you know a nicer method. Generally, can we pass variables between 
> plugins or builders of the same plugin? If possible, I would like not to be 
> redirected to the use of another plugin.
> 
> Thank you!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to