Created
January 6, 2016 10:34
-
-
Save tszpinda/61a40e063107313361c4 to your computer and use it in GitHub Desktop.
Jenkins count flaky tests
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 jobNameStartsWith = 'EPC-1426' | |
def textToMatch = "Flakes" | |
Jenkins.instance.items.findAll { it.displayName.startsWith(jobNameStartsWith) } | |
.each { job -> | |
if(job.builds) { | |
def build = job.isBuilding() ? job.builds[1] : job.builds[0] | |
def log = build.logFile.text | |
def regexPattern = "(?i).*${textToMatch}.*" | |
def summary = log =~ /${regexPattern}/ | |
println "${summary.size()}: $job.displayName" | |
} | |
} | |
return "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment