-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: groovy-plugin
-
None
Summary
Attempting to use the TOOLNAME_HOME variable within an Execute system Groovy script build step causes error due to no variable expansion.
java.io.FileNotFoundException: /jenkins-home/workspace/FreeEnvVar/${TESTTOOL_HOME}/script.groovy (No such file or directory)
Steps to reproduce
- Install custom build tool plugin and system groovy script plugin
- Create a custom build tool called "TestTool" which downloads a file from some URL
- Create a freestyle job
- In the freestyle job, select "Install custom tools" and a Tool which has a Tool Selection of "TestTool". Be sure to select the the "Convert #ToolName_HOME variables to the upper-case"

- In the build steps section of the freestyle job, add a step to "Execute System Groovy script" with the "Groovy Script File" option selected and the path to the groovy script file should be "TESTTOOL_HOME"

- Save the job
Expect behavior
When you run the job, the TESTTOOL_HOME variable is correctly explanded before the System Groovy Step evalutes the file location
Actual behavior
When you run the job, the TESTTOOL_HOME variable is not corretly expanded by the System Groovy Step, resulting in an error like this:
FATAL: /jenkins-home/workspace/FreeEnvVar/${TESTTOOL_HOME}/script.groovy (No such file or directory)
java.io.FileNotFoundException: /jenkins-home/workspace/FreeEnvVar/${TESTTOOL_HOME}/script.groovy (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at hudson.FilePath.read(FilePath.java:1754)
at hudson.FilePath.readToString(FilePath.java:1855)
at hudson.plugins.groovy.FileSystemScriptSource.getSecureGroovyScript(FileSystemScriptSource.java:31)
at hudson.plugins.groovy.SystemGroovy.run(SystemGroovy.java:95)
at hudson.plugins.groovy.SystemGroovy.perform(SystemGroovy.java:59)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:407)
- relates to
-
JENKINS-19892 TOOL_HOME doesn't work in PATH
-
- In Review
-