I've configured the following setting to load environment variables from a .properties file:
1. Manage Jenkins > Manage Nodes > Node1 > Configure
2. Under Node Properties enabled the checkbox for 'Prepare Jobs environment'
3. In 'Properties File Path' I specify the path to the .properties file
In the job which is running on this node, I then have a script which is just echoing the environment variable which is supposed to be loaded from the .properties file, but this is always empty. The Output shows:
---------------------------------------------------
Started by user anonymous
[EnvInject] - Loading node environment variables.
Building remotely on Node1 (slave) in workspace C:\jenkins\workspace\EnvInject Test
[EnvInject Test] $ powershell.exe "& 'C:\Users\ADMINI~1\AppData\Local\Temp\hudson4027871172984182957.ps1'"
Finished: SUCCESS
---------------------------------------------------
If I inject the .properties file in the Project from Build Environment or as a build step, the variable is populated, but I can't get this working by configuring it in the Node settings. Am I missing something or did I misunderstand how to use the Node setting?
Would appreciate any help.
Thanks,
Josh