Regression: Variables set in generateEnv are unset by the SECOND envInject

Details

Description

Effective in 2.1.5 (and possibly earlier) the behaviour of multiple invocations of envInject has changed. We are experiencing a regression issue in multiple jobs.

It appears that the second invocation of envInject "undoes" the settings laid down in the previous invocation, but only for values that we set in GenerateEnv. Prior to this, settings were additive, and in fact, they are for values that are NOT in the generate step.

Taking a guess, and assuming that the system keeps a list of variables to playback at the beginning of each step, it feels like the env playback is adding the base env settings from generate before each envInject,
> GenList+Inject1
> GenList+Inject1+GenList+Inject2
> GenList+Inject1+GenList+Inject2+GenList+Inject3

and the effect is that settings in Inject1 that overrode GenList will only work after the first inject.

We are seeing this behaviour in multiple builds after upgrading to 2.73 Jenkins and 2.1.5 envInject

Activity

I believe it was introduced in 2.1.4, see the warning in the changelog and JENKINS-47370. The plugin is explicitly marked as incompatible

Tony Bridges just to set the expectation, I do not longer maintain the plugin. It's open for adoption for ~2 years. I will be happy to review pull requests and get them landed, but I do not have any bandwidth to work on the fixes there.

Oleg Nenashev
added a comment - 2018-08-26 07:55 I believe it was introduced in 2.1.4, see the warning in the changelog and JENKINS-47370 . The plugin is explicitly marked as incompatible
Tony Bridges just to set the expectation, I do not longer maintain the plugin. It's open for adoption for ~2 years. I will be happy to review pull requests and get them landed, but I do not have any bandwidth to work on the fixes there.
My response regarding the introduced regression is here: https://issues.jenkins-ci.org/browse/JENKINS-47370?focusedCommentId=331761&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-331761