Last active
January 6, 2016 09:36
-
-
Save tszpinda/9cf892ff389690169ca2 to your computer and use it in GitHub Desktop.
jenkins count text in console
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
def jobNameStartsWith = 'EPC-1426-single-version' | |
def textToMatch = "Total time" | |
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