Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scrain/85b0a72e70b98de0e9d348dce4dcecb9 to your computer and use it in GitHub Desktop.
Save scrain/85b0a72e70b98de0e9d348dce4dcecb9 to your computer and use it in GitHub Desktop.
Jenkins script to find all jobs with specific string in latest build's console output
BUILD_STRING = "ERROR"
for (job in Jenkins.instance.getAllItems(Job.class)) {
if (job.builds[0]?.log?.contains(BUILD_STRING)) {
println "${job.name}: ${job.builds[0].id}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment