Using local variables, that include global Variables?

I’m using a Pipeline on the Jenkins-Server (master). Attached to the server are 40 agents. The Agents have different configurations, like Harddrives and or operation systems, could be windows, linux etc. The Pipeline-Jobs are using a toolset, which contains several build-tools like sdk, ant, groovy etc. and the toolset is versioned, like “toolset1_1”, “toolset3_4” etc.

I defined a global environment_variable in the Jenkins-Server (master). And i would like to use this global variable, to define a local variable for the agents. The target is, to configure a variable only once on the jenkins-Server without the need, to define the toolset-path individually on each agent.

Example:
For the Jenkins-Server:
TOOLSET_VERSION=2_7

For the Agent A
TOOLSET_HOME=c:\tools\toolset_%TOOLSET_VERSION%\

For the Agent B
TOOLSET_HOME=/var/lib/toolset_%TOOLSET_VERSION%

For the Agent C
TOOLSET_HOME=D:\toolset_%TOOLSET_VERSION%

But the combined local Variable is not working out, ill receive: c:\tools\toolset_%TOOLSET_VERSION% instead of the wanted c:\tools\toolset_2_7

How are you setting that variable? In the agent environment configuation screen?

How are you confirming that variable isn’t set?

Have you looked at the Jenkins tool system that can extract to an agent as needed?

1 Like

Thanks!

The hint with Jenkins tools system helped me figuring out a solution. I configured a system-variable on the master which fits for 90% of all agents and on the few with different file systems i just override this variable in the agent-configuration.

1 Like