Forked from icybin/jenkins_script_print_last_builds_for_all_jobs.groovy
Created
September 7, 2019 05:32
-
-
Save icy/0fc9d9cf6255a23c89e2229a9357da51 to your computer and use it in GitHub Desktop.
Jenkins: Print last build information for all jobs
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
| // Author : Ky-Anh Huynh | |
| // License: MIT | |
| // Origin : https://gist.github.com/dnozay/e7afcf7a7dd8f73a4e05#file-disk-usage-retention-groovy | |
| jobs = Jenkins.instance.getAllItems() | |
| jobs.each { j -> | |
| if (j instanceof com.cloudbees.hudson.plugins.folder.Folder) { return } | |
| if (j instanceof jenkins.branch.OrganizationFolder) { return } | |
| if (j instanceof org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject) { return } | |
| numbuilds = j.builds.size() | |
| println 'JOB: ' + j.fullName | |
| if (numbuilds == 0) { | |
| println ' -> no build' | |
| } else { | |
| lastbuild = j.builds[numbuilds - 1] | |
| println ' -> lastbuild: ' + lastbuild.displayName + ' = ' + lastbuild.result + ', time: ' + lastbuild.timestampString2 | |
| } | |
| } | |
| '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment