Created
November 8, 2013 16:35
-
-
Save ogavrisevs/7373751 to your computer and use it in GitHub Desktop.
Java couses example
This file contains hidden or 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 jenkins.* | |
import jenkins.model.* | |
import hudson.* | |
import hudson.model.* | |
def printCouse(cause) { | |
println("cause ========> : "+ cause ) | |
println("cause.class ========> : "+ cause.class ) | |
if (cause instanceof Cause.UserIdCause){ | |
userCause = ( Cause.UserIdCause) cause | |
println("userCause.getUserName() ========>"+ userCause.getUserName() ) | |
} | |
if (cause instanceof Cause.UpstreamCause){ | |
upstreamCause =( Cause.UpstreamCause) cause | |
for( upCause in upstreamCause.getUpstreamCauses()) { | |
printCouse(upCause) | |
} | |
} | |
} | |
for (job in Hudson.instance.items) { | |
def action = job.getAction(CauseAction.class) | |
if (action != null) { | |
println("action.getCauses() ========> "+ action.getCauses()) | |
println("action.class ========> "+ action.class) | |
for (cause in action.getCauses() ){ | |
printCouse(cause) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment