Quantcast

How to grab full map of EnvVars in pipeline?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to grab full map of EnvVars in pipeline?

Dzmitry Kashlach-2
Hi,

I'm supporting BlazeMeter Plugin and want to add pipeline support to it.
For this purpose I implement SimpleBuildStep.

Have an issue with few parameters which should support and resolve user-defined variables from "Manage Jenkins" section(using EnvVars map for this).

When I run plugin inside of pipeline, EnvVars has fewer variables(about 15), than it has in freestyle-job(about 50), so I cannot resolve variables which user is setting in pipeline script.

How can I overcome this? 

Thank you.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/a4255d21-7966-44d8-89e5-1f802b22cdd3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to grab full map of EnvVars in pipeline?

Dzmitry Kashlach-2
Here is how I'm getting EnvVars:

run.getEnvironment(listener)

On Thursday, March 16, 2017 at 12:24:39 PM UTC+3, Dzmitry Kashlach wrote:
Hi,

I'm supporting <a href="https://wiki.jenkins-ci.org/display/JENKINS/BlazeMeter+Plugin" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FBlazeMeter%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGd6xLNajr53xOxTdoUy5jJy2kwCg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FBlazeMeter%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGd6xLNajr53xOxTdoUy5jJy2kwCg&#39;;return true;">BlazeMeter Plugin and want to add pipeline support to it.
For this purpose I implement SimpleBuildStep.

Have an issue with few parameters which should support and resolve user-defined variables from "Manage Jenkins" section(using EnvVars map for this).

When I run plugin inside of pipeline, EnvVars has fewer variables(about 15), than it has in freestyle-job(about 50), so I cannot resolve variables which user is setting in pipeline script.

How can I overcome this? 

Thank you.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/fcb74be3-4f4c-43d0-9f7d-c2714606b028%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to grab full map of EnvVars in pipeline?

Jesse Glick-4
In reply to this post by Dzmitry Kashlach-2
On Thu, Mar 16, 2017 at 5:24 AM, Dzmitry Kashlach
<[hidden email]> wrote:
> Have an issue with few parameters which should support and resolve
> user-defined variables from "Manage Jenkins" section(using EnvVars map for
> this).
>
> When I run plugin inside of pipeline, EnvVars has fewer variables(about 15),
> than it has in freestyle-job(about 50)

Sounds like JENKINS-40070 to me.

Not an issue for a true `Step` run inside a `node` block, but
`SimpleBuildStep` has no equivalent API (JENKINS-29144).

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0k0bWwxxy1y__KsVj8qHJQ6k8cQEeptKHTC3qa_Vgxow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to grab full map of EnvVars in pipeline?

Dzmitry Kashlach-2
In reply to this post by Dzmitry Kashlach-2
Do you mean that it's better to implement custom step instead of using SimpleBuildStep for getting EnvVars?

On Thursday, March 16, 2017 at 12:24:39 PM UTC+3, Dzmitry Kashlach wrote:
Hi,

I'm supporting <a href="https://wiki.jenkins-ci.org/display/JENKINS/BlazeMeter+Plugin" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FBlazeMeter%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGd6xLNajr53xOxTdoUy5jJy2kwCg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FBlazeMeter%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGd6xLNajr53xOxTdoUy5jJy2kwCg&#39;;return true;">BlazeMeter Plugin and want to add pipeline support to it.
For this purpose I implement SimpleBuildStep.

Have an issue with few parameters which should support and resolve user-defined variables from "Manage Jenkins" section(using EnvVars map for this).

When I run plugin inside of pipeline, EnvVars has fewer variables(about 15), than it has in freestyle-job(about 50), so I cannot resolve variables which user is setting in pipeline script.

How can I overcome this? 

Thank you.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/1f621168-c531-4771-8242-ffeaf47ad9d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to grab full map of EnvVars in pipeline?

Jesse Glick-4
On Fri, Mar 17, 2017 at 4:09 AM, Dzmitry Kashlach
<[hidden email]> wrote:
> Do you mean that it's better to implement custom step instead of using
> SimpleBuildStep for getting EnvVars?

For now, yes you need to.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3aRyND56bqr%3DmgnmDEgbbP3DX7wiV4wab4O178A1MB6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to grab full map of EnvVars in pipeline?

Dzmitry Kashlach-2
Clear, thank you, Jesse.

On Fri, Mar 17, 2017 at 5:46 PM, Jesse Glick <[hidden email]> wrote:
On Fri, Mar 17, 2017 at 4:09 AM, Dzmitry Kashlach
<[hidden email]> wrote:
> Do you mean that it's better to implement custom step instead of using
> SimpleBuildStep for getting EnvVars?

For now, yes you need to.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/gZQjSaVtluU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3aRyND56bqr%3DmgnmDEgbbP3DX7wiV4wab4O178A1MB6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--

Thanks,
   Dzmitry Kashlach

Tel. +375291142462
Skype: dmitry.kashlach

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAAKqVTYBiu%3D1j8nzuMm4hpXWMHmxEixjvRpA%3D26AoohvVZFugA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to grab full map of EnvVars in pipeline?

Dzmitry Kashlach-2
In reply to this post by Dzmitry Kashlach-2
One more question: I've extended 

SynchronousNonBlockingStepExecution<Void>

as it is described here, but I'm still getting 15 variables via calling run.getEnvironment(listener).

Is there another way of getting variables in pipeline ?

Thanks!

On Thursday, March 16, 2017 at 12:24:39 PM UTC+3, Dzmitry Kashlach wrote:
Hi,

I'm supporting <a href="https://wiki.jenkins-ci.org/display/JENKINS/BlazeMeter+Plugin" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FBlazeMeter%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGd6xLNajr53xOxTdoUy5jJy2kwCg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FBlazeMeter%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGd6xLNajr53xOxTdoUy5jJy2kwCg&#39;;return true;">BlazeMeter Plugin and want to add pipeline support to it.
For this purpose I implement SimpleBuildStep.

Have an issue with few parameters which should support and resolve user-defined variables from "Manage Jenkins" section(using EnvVars map for this).

When I run plugin inside of pipeline, EnvVars has fewer variables(about 15), than it has in freestyle-job(about 50), so I cannot resolve variables which user is setting in pipeline script.

How can I overcome this? 

Thank you.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/b035ec0b-d8ee-4817-8a11-68902fe862af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to grab full map of EnvVars in pipeline?

Jesse Glick-4
On Thu, Mar 23, 2017 at 5:40 AM, Dzmitry Kashlach
<[hidden email]> wrote:
> I'm still getting 15 variables via calling
> run.getEnvironment(listener).

Right—those are the build-wide variables available in any scope.

> Is there another way of getting variables in pipeline ?

getContext().get(EnvVars.class)

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2Oo2uK_n-t70EfPm0PuMDVF2xdK0oOs9ibUa4NJ2FP9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to grab full map of EnvVars in pipeline?

Oleg Nenashev
Just in case some of the 50 variables get contributed by EnvInject's Job and Node properties, keep in mind the plugin is not fully integrated with Pipeline (JENKINS-42614), so the variables may be missing independently of the call approach you use. There is no short-term plan to fix that.

BR, Oleg
 
четверг, 23 марта 2017 г., 16:36:36 UTC+1 пользователь Jesse Glick написал:
On Thu, Mar 23, 2017 at 5:40 AM, Dzmitry Kashlach
<<a href="javascript:" target="_blank" gdf-obfuscated-mailto="1T5SjWGZBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">dzmitry....@blazemeter.com> wrote:
> I'm still getting 15 variables via calling
> run.getEnvironment(listener).

Right—those are the build-wide variables available in any scope.

> Is there another way of getting variables in pipeline ?

getContext().get(EnvVars.class)

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/0bfe16a2-6141-4f57-9cf2-075a88717f3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to grab full map of EnvVars in pipeline?

Dzmitry Kashlach-2
Thank you, Oleg.

On Mon, Mar 27, 2017 at 11:19 AM, Oleg Nenashev <[hidden email]> wrote:
Just in case some of the 50 variables get contributed by EnvInject's Job and Node properties, keep in mind the plugin is not fully integrated with Pipeline (JENKINS-42614), so the variables may be missing independently of the call approach you use. There is no short-term plan to fix that.

BR, Oleg
 
четверг, 23 марта 2017 г., 16:36:36 UTC+1 пользователь Jesse Glick написал:
On Thu, Mar 23, 2017 at 5:40 AM, Dzmitry Kashlach
<[hidden email]> wrote:
> I'm still getting 15 variables via calling
> run.getEnvironment(listener).

Right—those are the build-wide variables available in any scope.

> Is there another way of getting variables in pipeline ?

getContext().get(EnvVars.class)

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/gZQjSaVtluU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/0bfe16a2-6141-4f57-9cf2-075a88717f3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Thanks,
   Dzmitry Kashlach

Tel. +375291142462
Skype: dmitry.kashlach

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAAKqVTatBvYwr6uxi3nWK7%2BaDhSFu88Vt6YchifkTTTgCE1%2B3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...