Created
March 22, 2016 13:37
-
-
Save srz-zumix/45f3224776d73984e2b4 to your computer and use it in GitHub Desktop.
ズンドコキヨシ for Jenkins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hudson.model.Cause.UpstreamCause | |
static checkZUN(manager, cause, count) | |
{ | |
def causes = cause.getUpstreamCauses() | |
def name = cause.getUpstreamProject() | |
manager.listener.logger.println name | |
if( name == "ZUN" ) { | |
count += 1 | |
if( count == 4 ) { | |
return true | |
} | |
} else { | |
return false | |
} | |
cause = null | |
causes.each { | |
if( it instanceof UpstreamCause ) { | |
cause = it | |
return | |
} | |
} | |
return checkZUN(manager, cause, count) | |
} | |
static setNext(manager) | |
{ | |
def r = Math.floor( Math.random() * 2 ) as int | |
manager.listener.logger.println r | |
if( r ) { | |
manager.buildUnstable() | |
} else { | |
manager.buildFailure() | |
} | |
} | |
static check(manager) | |
{ | |
def name = manager.build.getProject().getName() | |
manager.listener.logger.println name | |
if( name == "DOKO" ) { | |
def cause = manager.build.getCause(UpstreamCause.class) | |
if( checkZUN(manager, cause, 0) ) { | |
return true | |
} | |
} | |
setNext(manager) | |
return false | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment