-
Bug
-
Resolution: Unresolved
-
Critical
-
None
In the virtual machine OS environment, there is a variable with the name EXAMPLE_VARIALBE. The variable has a default value which is needed by local tools. In Jenkins jobs, I am using the EnvInject plugin to inject new environment variables but also to overwrite EXAMPLE_VARIALBE with a new value. This is standard action, however, after upgrading the Environment Injector plugin from 2.4.0 to the newest one, it started to generate an error:
ERROR: Not all environment variables could be successfully injected. Check for similarly-named environment variables.
Catching such behavior was introduced due to a ticket: https://issues.jenkins.io/browse/JENKINS-60559
https://github.com/jenkinsci/envinject-plugin/commit/25669f16a5b0bb20dc97cc29e8c237bec77ab2db
And for unknown reasons, the warning message was changed to error one, which in my opinion is completely incorrect and misleading:
https://github.com/jenkinsci/envinject-plugin/commit/1bd30955b37acce2e81ccc871c7642ebf4344e03
First, the message should be clearer and inform the user of what is really happening. It could be a warning or just information, but not an error.
Second, the case from https://issues.jenkins.io/browse/JENKINS-60559 should also be caught separately, as the first message concerns a different case.
Could you change this misleading message, which is printed when you inject env that already exists in the given environment:
misleading message (used by updated EnvInjector plugin when one of injected env that already exist):
ERROR: Not all environment variables may have been successfully injected. Check environment variables with similar names.
To:
more appropriate message:
WARNNING: The environment variable already exists and has been overwritten by the EnvInjector plug-in. <env_name>=<value_before_injection> overwritten to <env_name>=<value_after_injection>
Or at least please bring back this as a warning and not an error, as EnvInect overwrites envs without an issue:
WARNING: Not all environment variables may have been successfully injected. Check environment variables with similar names.