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

setting not persistent for "ERRORLEVEL to set build unstable"

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            danielbeck Daniel Beck added a comment -

            Fixed towards 2.41

            Show
            danielbeck Daniel Beck added a comment - Fixed towards 2.41
            Hide
            danielbeck Daniel Beck added a comment -

            Oliver Gondža FYI for your consideration into 2.32.2. This one will be late but might be worth it.

            Show
            danielbeck Daniel Beck added a comment - Oliver Gondža FYI for your consideration into 2.32.2. This one will be late but might be worth it.
            Hide
            scm_issue_link 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)

            Show
            scm_issue_link 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)

              People

              • Assignee:
                danielbeck Daniel Beck
                Reporter:
                pluntke Jan Pluntke
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: