pixman20 created JENKINS-12809: ---------------------------------- Summary: Injecting from file removes backslashes on ${WORKSPACE} Key: JENKINS-12809 URL: https://issues.jenkins-ci.org/browse/JENKINS-12809 Project: Jenkins Issue Type: Bug Components: envinject Affects Versions: current Environment: Windows Server 2003 Reporter: pixman20 Assignee: gbois Priority: Critical
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 ------------------------------------------------------------------ -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira