Last active
September 7, 2019 05:32
-
-
Save icybin/9e7022f10d2ffc42cf69675dedcecca1 to your computer and use it in GitHub Desktop.
Jenkins: Print last build information for all jobs
This file contains 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