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

Confusing error message when leaving script path empty

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: postbuildscript-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.613, Post-Build Script Plug-in 0.17
    • Similar Issues:

      Description

      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

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Daniel Heid
          Path:
          src/main/java/org/jenkinsci/plugins/postbuildscript/PostBuildScript.java
          http://jenkins-ci.org/commit/postbuildscript-plugin/e5520b53d5c07e31feda967d088e7ec58418b144
          Log:
          JENKINS-28825 Confusing error message when leaving script path empty

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Heid Path: src/main/java/org/jenkinsci/plugins/postbuildscript/PostBuildScript.java http://jenkins-ci.org/commit/postbuildscript-plugin/e5520b53d5c07e31feda967d088e7ec58418b144 Log: JENKINS-28825 Confusing error message when leaving script path empty

            People

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

              Dates

              • Created:
                Updated:
                Resolved: