Created
August 6, 2018 04:08
-
-
Save icy/d0ef22495bbe5afbb98585ff2046c752 to your computer and use it in GitHub Desktop.
jenkins_script_print_last_builds_for_all_jobs.groovy
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