How to grab full map of EnvVars in pipeline?

173 views
Skip to first unread message

Dzmitry Kashlach

unread,
Mar 16, 2017, 5:24:39 AM3/16/17
to Jenkins Developers
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.

Dzmitry Kashlach

unread,
Mar 16, 2017, 9:14:16 AM3/16/17
to Jenkins Developers
Here is how I'm getting EnvVars:

run.getEnvironment(listener)

Jesse Glick

unread,
Mar 16, 2017, 2:17:41 PM3/16/17
to Jenkins Dev
On Thu, Mar 16, 2017 at 5:24 AM, Dzmitry Kashlach
<dzmitry....@blazemeter.com> 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).

Dzmitry Kashlach

unread,
Mar 17, 2017, 4:09:08 AM3/17/17
to Jenkins Developers
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:

Jesse Glick

unread,
Mar 17, 2017, 10:46:50 AM3/17/17
to Jenkins Dev
On Fri, Mar 17, 2017 at 4:09 AM, Dzmitry Kashlach
<dzmitry....@blazemeter.com> 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.

Dzmitry Kashlach

unread,
Mar 17, 2017, 1:04:22 PM3/17/17
to jenkin...@googlegroups.com
Clear, thank you, Jesse.


--
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 jenkinsci-dev+unsubscribe@googlegroups.com.
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

Skype: dmitry.kashlach

Dzmitry Kashlach

unread,
Mar 23, 2017, 5:40:08 AM3/23/17
to Jenkins Developers
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:

Jesse Glick

unread,
Mar 23, 2017, 11:36:36 AM3/23/17
to Jenkins Dev
On Thu, Mar 23, 2017 at 5:40 AM, Dzmitry Kashlach
<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)

Oleg Nenashev

unread,
Mar 27, 2017, 4:19:17 AM3/27/17
to Jenkins Developers
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 написал:

Dzmitry Kashlach

unread,
Mar 27, 2017, 4:22:33 AM3/27/17
to jenkin...@googlegroups.com
Thank you, Oleg.

--
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 jenkinsci-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Prabhas Gupte

unread,
Jul 10, 2017, 12:53:56 PM7/10/17
to Jenkins Developers
Which package did you import to get SynchronousNonBlockingStepExecution
I am somehow unable to find it. :(

Baptiste Mathus

unread,
Jul 10, 2017, 2:50:14 PM7/10/17
to Jenkins Developers

--
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 jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/7b9f3267-5fe0-4f12-b50c-dae5da156214%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages