def isSuccess(self, builderStatus): # Helper function to return True if the builder is not failing. # The function will return false if the current state is "offline", # the last build was not successful, or if a step from the current # build(s) failed. # Make sure the builder is online. if builderStatus.getState()[0] == 'offline': return False # Look at the last finished build to see if it was success or not. lastBuild = builderStatus.getLastFinishedBuild() if lastBuild and lastBuild.getResults() != builder.SUCCESS: return False # Check all the current builds to see if one step is already # failing. currentBuilds = builderStatus.getCurrentBuilds() if currentBuilds: for build in currentBuilds: for step in build.getSteps(): if step.getResults()[0] == builder.FAILURE: return False # The last finished build was successful, and all the current builds # don't have any failed steps. return True