Script task should emit file permission errors to build log

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Done
    • 6.5.0
    • Component/s: Logs
    • None

      If file is not executable all user sees is:

      Failing task since return code of [/home/bamboo/bamboo-agent-home/xml-data/build-dir/PLAY-ES-JOB1/myScript.sh] was -1 while expected 0
      

      -1 is not the proper return code for permission errors, so user is left clueless.

      Inside the task code however:

                   if (scriptFile.exists()) {
                      // This can happen due to noexec mounted filesystems or the file didn't have perms in the first place
                      if (config.isRunAsExecutable() && !scriptFile.canExecute()) {
      // *** This should emit to build log!
                          log.warn("Command [" + scriptFile.getAbsolutePath() + "] is not executable, trying to run anyway.");
                      }
                  } else {
      // *** This should emit to build log too!
                      log.info("File [" + scriptFile.getAbsolutePath() + "] doesn't exist, trying to run [" + config.getScriptFilename() + "] anyway."); //maybe it's on PATH, let's see what happens
                  }
      

      So the system is properly warning about the execution issue, but only in a place system admins will see it. This should be emitted as an error/NOTICE to the build log.

            Assignee:
            Alexey Chystoprudov
            Reporter:
            Alexey Chystoprudov
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: