Created
July 25, 2018 13:20
-
-
Save sumew/fc5b3f63e853cc9a32ff6d4fb3de068c to your computer and use it in GitHub Desktop.
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
//Returns a list of Jobname: BuildNumbers that contain the term provided | |
def searchLogsForTerm(term) { | |
def folders = { item -> | |
item instanceof jenkins.branch.OrganizationFolder | |
} | |
Jenkins.instance.items.findAll(folders).collect { organizationFolder -> organizationFolder.items}.flatten() | |
.collect { workflowMultiBranchProject -> workflowMultiBranchProject.items }.flatten() | |
.collect { workflowJob -> | |
def matchingBuilds = workflowJob.builds.findAll { build -> build.log.contains(term) } | |
matchingBuilds.collect { build -> println "$workflowJob.fullName: $build.displayName"} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment