Can I use Groovy Postbuild with Build Flow or should I use only the first?

On Tuesday, March 25, 2014 4:51:54 PM UTC, rginga wrote:
>
>  I do not have an answer but I have some knowledge. The only thing you 
> have left after “Build” runs is “b”. from the build flow Wiki page:
>
>  
>
> Environment variables from a job can be obtained using the following, 
> which is especially useful for getting things like the checkout revision 
> used by the SCM plugin ('P4_CHANGELIST', 'GIT_REVISION', etc) :
>
> def revision = b.environment.get( "GIT_REVISION" )
>
>  
>
> So, if you predefine the environment of “Build” to have those variables, 
> then the above command will get them. But it might only get the original 
> value and not any changed value that “Build” sets.
>
>  
>
> There is another plugin called Groovy Postbuild which give you access to 
> the “b” build object of “Build” while it is running:
>
>  
>
> Executes a groovy script in the Hudson JVM. Typically, the script checks 
> some conditions and changes accordingly the build result, puts badges next 
> to the build in the build history and/or displays information on the build 
> summary page. 
> The groovy script can use the variable *manager*, which provides access 
> to the following objects and methods:
>
>    - hudson - the current Hudson instance.
>    - build - the current build.
>    - listener - the build listener.
>
> If you can figure out a way of “setting” the environment variables in the 
> object “build” at the end of job “Build”, then you might be able to use 
> b.environment.get 
> get it. but I am not yet a Groovy Guru. Perhaps there is a 
> build.environment.set method.
>
>  
>
> *From:* [email protected] <javascript:> [mailto:
> [email protected] <javascript:>] *On Behalf Of *
> [email protected] <javascript:>
> *Sent:* Tuesday, March 25, 2014 11:25 AM
> *To:* [email protected] <javascript:>
> *Subject:* How to access jobs variables with Build Flow Plugin?
>
>  
>  
> My Build Flow job has the following structure:
>  
> b = build("Build")
> parallel (
>   {
>     build("Test-Device", device: "id1")
>   },
>   {
>     build("Test-Device", device: "id2")
>   }
> )
>  
>
> In the Build job, I have a variable: export DEVICES="id1 id2". From the 
> flow DSL, how can I have access to this variable in order to use its value 
> on the consequent parallel jobs?
>  
> -- 
> 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] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>  

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to