# Using local variables, that include global Variables?

**URL:** <https://community.jenkins.io/t/using-local-variables-that-include-global-variables/2537>\
**Category:** Using Jenkins\
**Tags:** question\
**Created:** [May 25, 2022, 2:54pm UTC](https://community.jenkins.io/t/using-local-variables-that-include-global-variables/2537 "2022-05-25T14:54:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ayke](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@Ayke](https://community.jenkins.io/u/Ayke)\
**Post date:** [May 25, 2022, 2:54pm UTC](https://community.jenkins.io/t/using-local-variables-that-include-global-variables/2537/1 "2022-05-25T14:54:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [May 26, 2022, 9:17pm UTC](https://community.jenkins.io/t/using-local-variables-that-include-global-variables/2537/2 "2022-05-26T21:17:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Ayke](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@Ayke](https://community.jenkins.io/u/Ayke)\
**Post date:** [June 7, 2022, 3:04pm UTC](https://community.jenkins.io/t/using-local-variables-that-include-global-variables/2537/3 "2022-06-07T15:04:12Z")

</div>

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.
