How to manipulate the build result of a Jenkins pipeline job (back to 'SUCCESS')?

I guess this is by design, "result can only get worse" in setResult():

// result can only get worse
if (result==null || r.isWorseThan(result)) {
    result = r;
    LOGGER.log(FINE, this + " in " + getRootDir() + ": result is set to " + r, LOGGER.isLoggable(Level.FINER) ? new Exception() : null);
}

That's a bummer


For simplier answer, just get raw build, and set field directly:

currentBuild.rawBuild.@result = hudson.model.Result.SUCCESS