Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-28825

Confusing error message when leaving script path empty

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • postbuildscript-plugin
    • 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

            dheid Daniel Heid
            albert_gerritsen Albert Gerritsen
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: