ctx.ensureOcInstallation() did not work when PATH var was defined in root environment {....}
Env vars from root environment {....} can not be changed. Only using withEnv(){...} can change those vars.
I changed the oc commands using that method.
Attention: new is a check for setEnv in JenkinsPipelineContext. This would make the pipeline fail if a env var can not be changed.
void setEnv(String name, String value) {
script.env[name] = value
if (script.env[name] != value) {
script.error("""
setEnv of ${name} failure!
Variables defined inside 'environment {...}' cannot be overwritten!
Use 'withEnv(...) {...}' instead.""")
}
}
ctx.ensureOcInstallation() did not work when PATH var was defined in root environment {....} Env vars from root environment {....} can not be changed. Only using withEnv(){...} can change those vars.
I changed the oc commands using that method.
Attention: new is a check for setEnv in JenkinsPipelineContext. This would make the pipeline fail if a env var can not be changed.
Is this check a good idea?