Setting EnvVars

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting EnvVars

Weichselbaumer Michael (MWE 4170)
Hello,
 
Is there any way to set EnvVars of AbstractBuild (Run) so that other builders or publishers can use them?!
 
AbstractBuild offers me just a "getEnvVars()", which allows me to modify the envVars for doing whatever my actual builder/publisher is doing right now, but publishers, which are executed later in the build process, cannot use those new values.
 
Actually I'm using the Subversion Tagging Plugin, and I want it to create a Tag which I define, but it uses also AbtractBuild.getEnvVars. Any workaround for this?!
Reply | Threaded
Open this post in threaded view
|

Re: Setting EnvVars

Kohsuke Kawaguchi
Administrator
Weichselbaumer Michael wrote:
> Hello,
>  
> Is there any way to set EnvVars of AbstractBuild (Run) so that other
> builders or publishers can use them?!
>  
> AbstractBuild offers me just a "getEnvVars()", which allows me to modify
> the envVars for doing whatever my actual builder/publisher is doing
> right now, but publishers, which are executed later in the build
> process, cannot use those new values.

I'm not sure exactly what you want to do, but if you are writing a
plugin, BuildWrapper can influence environment variables during a build.

> Actually I'm using the Subversion Tagging Plugin, and I want it to
> create a Tag which I define, but it uses also AbtractBuild.getEnvVars.
> Any workaround for this?!
>


--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Re: Setting EnvVars

Weichselbaumer Michael (MWE 4170)
 Hello,

Thanks for your advice, but it seems to me that the changed envVars are
only used for the first builder that is executed. After this is done,
the svn-tag plugin gets the envVars by calling
"abstractBuild.getEnvVars()", but this returns the "normal" envVars, not
those i changed with the BuildWrapper.
But I want the envVars to be the same that are used with the builder.
How can I manage to use the same envVars (those generated by my
BuildWrapper) for everything that is executed during my build (Builds &
Publishers)?!


Weichselbaumer Michael wrote:
> Hello,
>  
> Is there any way to set EnvVars of AbstractBuild (Run) so that other
> builders or publishers can use them?!
>  
> AbstractBuild offers me just a "getEnvVars()", which allows me to
> modify the envVars for doing whatever my actual builder/publisher is
> doing right now, but publishers, which are executed later in the build

> process, cannot use those new values.

I'm not sure exactly what you want to do, but if you are writing a
plugin, BuildWrapper can influence environment variables during a build.

> Actually I'm using the Subversion Tagging Plugin, and I want it to
> create a Tag which I define, but it uses also AbtractBuild.getEnvVars.
> Any workaround for this?!
>


--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Setting EnvVars

Kohsuke Kawaguchi
Administrator
Weichselbaumer Michael wrote:
>  Hello,
>
> Thanks for your advice, but it seems to me that the changed envVars are
> only used for the first builder that is executed. After this is done,
> the svn-tag plugin gets the envVars by calling
> "abstractBuild.getEnvVars()", but this returns the "normal" envVars, not
> those i changed with the BuildWrapper.

But if you look at the code, the getEnvVars method includes all the env
vars from BuildEnvironments, which are what BuildWrappers create.

> But I want the envVars to be the same that are used with the builder.
> How can I manage to use the same envVars (those generated by my
> BuildWrapper) for everything that is executed during my build (Builds &
> Publishers)?!
>
>
> Weichselbaumer Michael wrote:
>> Hello,
>>  
>> Is there any way to set EnvVars of AbstractBuild (Run) so that other
>> builders or publishers can use them?!
>>  
>> AbstractBuild offers me just a "getEnvVars()", which allows me to
>> modify the envVars for doing whatever my actual builder/publisher is
>> doing right now, but publishers, which are executed later in the build
>
>> process, cannot use those new values.
>
> I'm not sure exactly what you want to do, but if you are writing a
> plugin, BuildWrapper can influence environment variables during a build.
>
>> Actually I'm using the Subversion Tagging Plugin, and I want it to
>> create a Tag which I define, but it uses also AbtractBuild.getEnvVars.
>> Any workaround for this?!
>>
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Re: Setting EnvVars

Weichselbaumer Michael (MWE 4170)
Yes, but in my plugin, a job can consist out of up to three builders.
After the first builder is successfully executed, "finally" from
RunnerImpl() is executed and deletes the buildwrapper. I "solved" the
problem by overwriting "RunnerImpl" and getting rid of the
finally-block. I know this is a bit messy - but it works - so far.


-----Original Message-----
From: Kohsuke Kawaguchi [mailto:[hidden email]]
Sent: Mittwoch, 30. Juli 2008 02:43
To: [hidden email]
Subject: Re: Setting EnvVars

Weichselbaumer Michael wrote:
>  Hello,
>
> Thanks for your advice, but it seems to me that the changed envVars
> are only used for the first builder that is executed. After this is
> done, the svn-tag plugin gets the envVars by calling
> "abstractBuild.getEnvVars()", but this returns the "normal" envVars,
> not those i changed with the BuildWrapper.

But if you look at the code, the getEnvVars method includes all the env
vars from BuildEnvironments, which are what BuildWrappers create.

> But I want the envVars to be the same that are used with the builder.
> How can I manage to use the same envVars (those generated by my
> BuildWrapper) for everything that is executed during my build (Builds
> & Publishers)?!
>
>
> Weichselbaumer Michael wrote:
>> Hello,
>>  
>> Is there any way to set EnvVars of AbstractBuild (Run) so that other
>> builders or publishers can use them?!
>>  
>> AbstractBuild offers me just a "getEnvVars()", which allows me to
>> modify the envVars for doing whatever my actual builder/publisher is
>> doing right now, but publishers, which are executed later in the
>> build
>
>> process, cannot use those new values.
>
> I'm not sure exactly what you want to do, but if you are writing a
> plugin, BuildWrapper can influence environment variables during a
build.
>
>> Actually I'm using the Subversion Tagging Plugin, and I want it to
>> create a Tag which I define, but it uses also
AbtractBuild.getEnvVars.
>> Any workaround for this?!
>>
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems
http://weblogs.java.net/blog/kohsuke/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Setting EnvVars

Kohsuke Kawaguchi
Administrator

I'm sorry, I still don't understand --- all your three builders are
executed in Build.java line 109, and the finally clause executes after that.

Weichselbaumer Michael wrote:

> Yes, but in my plugin, a job can consist out of up to three builders.
> After the first builder is successfully executed, "finally" from
> RunnerImpl() is executed and deletes the buildwrapper. I "solved" the
> problem by overwriting "RunnerImpl" and getting rid of the
> finally-block. I know this is a bit messy - but it works - so far.
>
>
> -----Original Message-----
> From: Kohsuke Kawaguchi [mailto:[hidden email]]
> Sent: Mittwoch, 30. Juli 2008 02:43
> To: [hidden email]
> Subject: Re: Setting EnvVars
>
> Weichselbaumer Michael wrote:
>>  Hello,
>>
>> Thanks for your advice, but it seems to me that the changed envVars
>> are only used for the first builder that is executed. After this is
>> done, the svn-tag plugin gets the envVars by calling
>> "abstractBuild.getEnvVars()", but this returns the "normal" envVars,
>> not those i changed with the BuildWrapper.
>
> But if you look at the code, the getEnvVars method includes all the env
> vars from BuildEnvironments, which are what BuildWrappers create.
>
>> But I want the envVars to be the same that are used with the builder.
>> How can I manage to use the same envVars (those generated by my
>> BuildWrapper) for everything that is executed during my build (Builds
>> & Publishers)?!
>>
>>
>> Weichselbaumer Michael wrote:
>>> Hello,
>>>  
>>> Is there any way to set EnvVars of AbstractBuild (Run) so that other
>>> builders or publishers can use them?!
>>>  
>>> AbstractBuild offers me just a "getEnvVars()", which allows me to
>>> modify the envVars for doing whatever my actual builder/publisher is
>>> doing right now, but publishers, which are executed later in the
>>> build
>>
>>> process, cannot use those new values.
>>
>> I'm not sure exactly what you want to do, but if you are writing a
>> plugin, BuildWrapper can influence environment variables during a
> build.
>>
>>> Actually I'm using the Subversion Tagging Plugin, and I want it to
>>> create a Tag which I define, but it uses also
> AbtractBuild.getEnvVars.
>>> Any workaround for this?!
>>>
>>
>>
>> --
>> Kohsuke Kawaguchi
>> Sun Microsystems
> http://weblogs.java.net/blog/kohsuke/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Re: Setting EnvVars

Weichselbaumer Michael (MWE 4170)
Somehow I managed to get it all wrong - you were right, but what if i
need some of the env vars for one of my publishers?!

>I'm sorry, I still don't understand --- all your three builders are
>executed in Build.java line 109, and the finally clause executes after
that.

Weichselbaumer Michael wrote:
>> Yes, but in my plugin, a job can consist out of up to three builders.
>> After the first builder is successfully executed, "finally" from
>> RunnerImpl() is executed and deletes the buildwrapper. I "solved" the
>> problem by overwriting "RunnerImpl" and getting rid of the
>> finally-block. I know this is a bit messy - but it works - so far.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]