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

setting not persistent for "ERRORLEVEL to set build unstable"

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • Jenkins 2.32.1 on Windows 8.1 64bit

      I am trying to use the new feature from https://issues.jenkins-ci.org/browse/JENKINS-23786 together with the "Execute Windows batch command" build step type to have a certain error level/return code of the batch command lead to result "Unstable" instead of "Failed".

      This works flawlessly when it is configured initially (steps below), but if the Jenkins service is restarted (or if you do "Manage Jenkins" -> "Reload Configuration from Disk" ), the setting is lost.

      To reproduce:

      • create a new "Freestyle project item" (e.g. "myUnstableTest")
      • "Add build step" -> "Execute Windows batch command"
        • "Command": exit 1
        • "Advanced" -> "ERRORLEVEL to set build unstable": 1
      • "Save"
      • "Build Now"
        -> the test result is "Unstable" (as expected)
      • "Jenkins" -> "Manage Jenkins" -> "Reload Configuration from Disk"
      • "Build" item "myUnstableTest" again
        -> the test result is now "Failed"

      If you check the configuration of "myUnstableTest", you will see that the setting for "ERRORLEVEL to set build unstable" is now empty.

      Interestingly, file jobs\myUnstableTest\config.xml still contains the correct setting

      <builders>
      <hudson.tasks.BatchFile>
      <command>exit 1</command>
      <unstableReturn>1</unstableReturn>
      </hudson.tasks.BatchFile>
      </builders>

      It appears as if the "<unstableReturn>" value is not read from the config file correctly.

          [JENKINS-40894] setting not persistent for "ERRORLEVEL to set build unstable"

          Code changed in jenkins
          User: Daniel Beck
          Path:
          core/src/main/java/hudson/tasks/BatchFile.java
          core/src/main/java/hudson/tasks/Shell.java
          test/src/test/java/hudson/tasks/BatchFileTest.java
          test/src/test/java/hudson/tasks/ShellTest.java
          test/src/test/resources/hudson/tasks/BatchFileTest/canLoadUnstableReturnFromDisk.zip
          test/src/test/resources/hudson/tasks/ShellTest/canLoadUnstableReturnFromDisk.zip
          http://jenkins-ci.org/commit/jenkins/93467c3f4bc74172b41543eea13e6771916d435a
          Log:
          [FIX JENKINS-40894] Restore unstableReturn in readResolve

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/hudson/tasks/BatchFile.java core/src/main/java/hudson/tasks/Shell.java test/src/test/java/hudson/tasks/BatchFileTest.java test/src/test/java/hudson/tasks/ShellTest.java test/src/test/resources/hudson/tasks/BatchFileTest/canLoadUnstableReturnFromDisk.zip test/src/test/resources/hudson/tasks/ShellTest/canLoadUnstableReturnFromDisk.zip http://jenkins-ci.org/commit/jenkins/93467c3f4bc74172b41543eea13e6771916d435a Log: [FIX JENKINS-40894] Restore unstableReturn in readResolve

          Daniel Beck added a comment -

          Fixed towards 2.41

          Daniel Beck added a comment - Fixed towards 2.41

          Daniel Beck added a comment -

          olivergondza FYI for your consideration into 2.32.2. This one will be late but might be worth it.

          Daniel Beck added a comment - olivergondza FYI for your consideration into 2.32.2. This one will be late but might be worth it.

          Code changed in jenkins
          User: Daniel Beck
          Path:
          core/src/main/java/hudson/tasks/BatchFile.java
          core/src/main/java/hudson/tasks/Shell.java
          test/src/test/java/hudson/tasks/BatchFileTest.java
          test/src/test/java/hudson/tasks/ShellTest.java
          test/src/test/resources/hudson/tasks/BatchFileTest/canLoadUnstableReturnFromDisk.zip
          test/src/test/resources/hudson/tasks/ShellTest/canLoadUnstableReturnFromDisk.zip
          http://jenkins-ci.org/commit/jenkins/e04da4a2c2c5578b3a92a9b928f30e53d75865a3
          Log:
          [FIX JENKINS-40894] Restore unstableReturn in readResolve

          (cherry picked from commit 93467c3f4bc74172b41543eea13e6771916d435a)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/hudson/tasks/BatchFile.java core/src/main/java/hudson/tasks/Shell.java test/src/test/java/hudson/tasks/BatchFileTest.java test/src/test/java/hudson/tasks/ShellTest.java test/src/test/resources/hudson/tasks/BatchFileTest/canLoadUnstableReturnFromDisk.zip test/src/test/resources/hudson/tasks/ShellTest/canLoadUnstableReturnFromDisk.zip http://jenkins-ci.org/commit/jenkins/e04da4a2c2c5578b3a92a9b928f30e53d75865a3 Log: [FIX JENKINS-40894] Restore unstableReturn in readResolve (cherry picked from commit 93467c3f4bc74172b41543eea13e6771916d435a)

            danielbeck Daniel Beck
            pluntke Jan Pluntke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: