Re: EnvInject Access to Manager
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 mfel...@gmail.com 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 jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: EnvInject Access to Manager
If by 'manager' you mean the object that gives you access to the Jenkins/Hudson instance, the current build, and the build listener, it's specific to Groovy Postbuild and doesn't exist in EnvInject. https://github.com/jenkinsci/groovy-postbuild-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/groovypostbuild/GroovyPostbuildRecorder.java On 02.07.2013, at 13:33, Eyal e...@marketspulse.com wrote: 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 mfel...@gmail.com 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 jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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 jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: EnvInject Access to Manager
Yes, I meant that. Is there a way to access the Jenkins/Hudson instance in EnvInject? I tried using Jenkins.getInstance() and it doesn't work. On Tue, Jul 2, 2013 at 5:26 PM, Daniel Beck m...@beckweb.net wrote: If by 'manager' you mean the object that gives you access to the Jenkins/Hudson instance, the current build, and the build listener, it's specific to Groovy Postbuild and doesn't exist in EnvInject. https://github.com/jenkinsci/groovy-postbuild-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/groovypostbuild/GroovyPostbuildRecorder.java On 02.07.2013, at 13:33, Eyal e...@marketspulse.com wrote: 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 mfel...@gmail.com 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 jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to a topic in the Google Groups Jenkins Users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/Mtm9-eBJcMI/unsubscribe. To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Eyal Zfira Development Manager Office: +972 9 95 44 551 |Fax: +972 9 95 44 553 Skype: eyal_zfira_sk | Site: www.marketspulse.com | [image: linkedin_icon.jpg] http://goog_1106994820/Follow us on *LinkedIn*http://www.linkedin.com/company/2306102 * http://www.linkedin.com/companies/770134* -- *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 jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: EnvInject Access to Manager
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 mfelz...@gmail.com 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
Re: EnvInject Access to Manager
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 mfel...@gmail.comjavascript: 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