Closed timja closed 2 years ago
For Pipeline builds, environment variables from agents are set only inside node blocks, for the EnvVars contextual object passed to steps running inside that block. You cannot use Run-level methods to get this information.
The problem is that some processes like the git checkout need proxy information before the evaluation of the Jenkinsfile. The proxy inherited from the Jenkins Controller may work on the controller but not necessarily on the agent.
jglick
Apparently, a system-wide git config entry is respected by the git-client plugin. This will be an acceptable workaround for us.
some processes like the git checkout need proxy information before the evaluation of the Jenkinsfile
You mean for Git checkouts run on the controller, say to get Jenkinsfile itself or some library? Not much to be done about that, since before the program starts it is unknown which agent will be used—or if any agent will be used, or many.
I mean the git checkout on the agent.
A checkout or git step run inside a node block ought to have access to environment variables defined on the corresponding computer (whatever is exposed to the agent JVM process). If that does not seem to be the case, file a bug in git-plugin with complete and exact steps to reproduce from scratch.
As seen in Freestyle jobs, a run has access to all environment variables of the executor (also optionally configured in the node configuration). This is not the case for multibranch pipelines. They merely get the environment variables that are dynamically set by Jenkins.
How to reproduce this bug:
Originally reported by meiswjn, imported from: Multibranch Pipeline jobs lack executor's environment variables