-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
Jenkins 1.613, Post-Build Script Plug-in 0.17
When configuring the post build action it is very easy to accidentally have an empty reference to a script. When executing the build task, it will fail with the error message:
"Error to resolve environment variables"
Which is misleading because the problem is the empty file path.
I briefly checked ScriptExecutor.java and noticed the plugin does check whether or not the file exists and then gives a sensible error message. But it does not explicitly check whether or not the path is actually a file. In this case it will be a directory and that is why the failure happens later when resolving the environment variables.
My suggestions would be the following:
- In getFilePath explicitly check that the path is a file
- When configuring the action, present a warning when the field is empty