My jenkins jobs use testlink to store their test results. The testlink plugin changes the build status to unstable if a test has failed.
However I want the build result to be determind by Xunit plugin in a post-build action because with Xunit you can adapt a failure threshold. The build should only be unstable if there are new errors.
I was hoping to do the following:
--test--
--testlink -> marked as unstable --
-- groovy scipt --> marked as succes --
build.result = hudson.model.Result.SUCCESS
-- xunit, checks threshold for unstable/succes --
However it seems impossible to change the build status back to success. So now testlink marks as unstable, and xunit mirros that status.
Is there a way to work around this problem?
Unfortunately, I don't think Jenkins will allow you to do that without an ugly hack.
For example, you can see a comment that clearly states that a result can only get worse in the Jenkins source code
e.g.
462 // result can only get worse
463 if (result==null || r.isWorseThan(result)) {
That being said....
Once the job is done, you can "technically" log on to the master and do whatever you want to already completed builds via changing the build.xmls directly.
For example, you could add a post build job that will go through the files on Jenkins master and do a mass update to replace "<result>UNSTABLE</result>"
to "<result>SUCCESS</result>"
to turn all builds to success. Once the job is done, forcefully restart the Jenkins server or reload its configuration for the changes to take effect.
I don't recommend this as who knows what will happen to Jenkins if you start going crazy like this. ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With