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"

          Jan Pluntke created issue -
          Daniel Beck made changes -
          Assignee New: Daniel Beck [ danielbeck ]
          Daniel Beck made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Daniel Beck made changes -
          Remote Link New: This issue links to "PR 2712 (Web Link)" [ 15240 ]
          Daniel Beck made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Daniel Beck made changes -
          Labels Original: configuration New: configuration lts-candidate

          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 made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Resolved [ 5 ]

          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.

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

              Created:
              Updated:
              Resolved: