-
Bug
-
Resolution: Fixed
-
Minor
-
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.
- links to
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