So.. there's no access to manager? On Saturday, December 22, 2012 4:37:32 AM UTC+2, Matt Felzani wrote: > > Wow, talk about service. Thanks a lot for adding that ... I'm using it > already and loving it. > > On Friday, December 21, 2012 6:52:15 PM UTC-5, gboissinot wrote: >> >> From EnvInject 1.75, you are able to use currentJob and currentBuild >> variables in order to access respectively to Job and Run instances. >> >> On Wed, Dec 19, 2012 at 3:58 PM, Matt Felzani <[email protected]> wrote: >> > Hi, >> > >> > I'm trying to use the EnvInject plugin. Specifically in the "Prepare an >> > environment for the run" > "Evaluated Groovy script" I want to be able >> to >> > get access to the job's BUILD_NUMBER so that I can inject a variable >> that is >> > partly composed of that value. >> > >> > I've tried code like: >> > def manager = binding.getVariable("manager") >> > def buildNumber = >> > manager.build.getEnvironment(manager.listener)['BUILD_NUMBER'] >> > >> > But I get an error of: >> > [EnvInject] - [ERROR] - SEVERE ERROR occurs: No such property: manager >> for >> > class: groovy.lang.Binding >> > >> > I've tried code like: >> > def buildNumber = >> > manager.build.getEnvironment(manager.listener)['BUILD_NUMBER'] >> > >> > But I get an error of: >> > >> > [EnvInject] - [ERROR] - SEVERE ERROR occurs: No such property: manager >> for >> > class: Script1 >> > >> > >> > Is the manager - via any API call - available at the time that script >> runs? >> > >> > The following code works (and it returns the correct value), but i'm >> just >> > trying to avoid having the Job's name (i.e. - "BnL Build") be >> hard-coded in >> > the script: >> > def env = Jenkins.instance.getItem("BnL >> > Build").getLastBuild().getEnvironment() >> > def buildNumber = env['BUILD_NUMBER'] >> > >> > Thanks in advance, >> > Matt >> > --
*Attention:** *This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error, please notify the sender immediately by replying to this message, and delete the original message from your system without making a copy. This e-mail is attributed to the sender and does not necessarily reflect the view of Markets Pulse P.S. Ltd. or any affiliate. Please consider the environment before printing this email. -- 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/groups/opt_out.
