I am trying to force a unit test job to success if the main build returned a failed exit code. Here is how I configured it and it is not working (see screenshot). Does anyone know any reason why this shouldn't work? In this example I just want to show that a failing job can be changed to a passing job by a groovy postbuild step. The plugin doc implies that this should work.
I found a discussion about that problem on jenkins-JIRA .
As a workaround it is proposed to use reflection to make the build successful:
manager.build.@result = hudson.model.Result.SUCCESS
This workaround doesn't work for me, but perhaps it can help you
Install Groovy Post Build Plug in. Then add the below Groovy Script.
manager.build.@result = hudson.model.Result.SUCCESS
Uncheck the Use Groovy Sandbox. This worked for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.