-
Bug
-
Resolution: Fixed
-
Critical
-
None
-
Windows Server 2003
When using a configuration file, ${WORKSPACE} cannot be used if it contains backslashes.
Obviously this causes a critical issue on Windows.
When using the content section it works fine.
Output shown in the "Injected Environment Variables" Page:
AAACONTENTVAR D:\jenkins\jobs\TEST_FAIL\workspace
AAAFILEVAR D:jenkinsjobsTEST_FAILworkspace
This behavior can be reproduced by doing the following:
1) Add build step "Execute batch script" and add the following content:
echo AAAFILEVAR=${WORKSPACE} > temp.config
2) Add build step "Inject environment variables" and add to properties file path:
temp.config
3) Add build step "Inject environment variables" and add to properties content:
AAACONTENTVAR=${WORKSPACE}
4) Add build step "Execute batch script" and add the following content:
@ECHO OFF
echo AAAFILEVAR = %AAAFILEVAR%
echo AAACONTENTVAR = %AAACONTENTVAR%
Console output:
------------------------------------------------------------------
Building on master in workspace D:\jenkins\jobs\TEST_FAIL\workspace
[workspace] $ cmd /c call C:\WINDOWS\TEMP\hudson6646008055064848449.bat
D:\jenkins\jobs\TEST_FAIL\workspace>echo AAAFILEVAR=${WORKSPACE} 1>temp.config
D:\jenkins\jobs\TEST_FAIL\workspace>exit 0
[EnvInject] - Injecting environment variables from a build step.
[EnvInject] - Injecting as environment variables the properties file path 'temp.config'
[EnvInject] - Variables injected successfully.
[EnvInject] - Injecting environment variables from a build step.
[EnvInject] - Injecting as environment variables the properties content
AAACONTENTVAR=${WORKSPACE}
[EnvInject] - Variables injected successfully.
[workspace] $ cmd /c call C:\WINDOWS\TEMP\hudson7725197076031217954.bat
AAAFILEVAR = D:jenkinsjobsTEST_FAILworkspace
AAACONTENTVAR = D:\jenkins\jobs\TEST_FAIL\workspace
Finished: SUCCESS
------------------------------------------------------------------
The current workaround appears to be manually defining a custom workspace with /s.