I suggest using EnvInject Jenkins plugin which provide some simple Groovy
capabilities to set environment variables.

On Wed, Jun 27, 2012 at 6:44 PM, wildejenkins <wildejenk...@gmail.com>wrote:

> Hi,
>
> I’ve been attempting to set an environment variable using groovy. So far
> the code I have is:
>
> import hudson.model.*
> import hudson.maven.*
> import hudson.tasks.*
>
> for(item in Hudson.instance.items) {
>     item.buildWrappers.each{
>       if (it instanceof hudson.plugins.setenv.SetEnvBuildWrapper){
>          println("Instance of hudson.plugins.setenv.SetEnvBuildWrapper ")
>
>         // do something
>       }
>     }
> }
> But the buildwrapper is never recognised as an instance
> of SetEnvBuildWrapper. Does anyone know the correct syntax to getting this
> working?
>
> Thanks,
>
> Andy.
>
>

Reply via email to