The environment clause appears to be ignored by plugins executing code such as the following,
EnvVars vars = build.getEnvironment(listener);
My current work-around is to define hard-coded default values for the pipeline "parameters", even for the agent "master" which runs on the same machine with the server...
agent {
label 'master'
}
parameters {
string(name: 'FORTIFY_HOME', defaultValue: "/MYTOOLDIR/fortify",
description: 'A work-around to the plugin using FORTIFY_HOME of the Jenkins server instead of that of the agent')
string(name: 'PATH', defaultValue:
"/MYTOOLDIR/fortify/bin:/usr/local/FOO/bin:/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
description: 'A work-around to the plugin using PATH of the Jenkins server instead of that of the agent')
}
I wish Jenkins in general its plugins in particular gave precendence to the agent's environment. I did not try to find the exact API to fetch that in the context of the plugin running on the server but aiming the given "agent". |