Skip to content

Instantly share code, notes, and snippets.



Last active Jul 16, 2019
What would you like to do?
Jenkins groovy script: get all builds started during a specific time
// This example lists all job that were started on Jul 16, 2019 between 1:20 PM and 2:30 PM
String df = 'MMM dd, yyyy h:mm a'
long startTimestamp = Date.parse(df, 'Jul 16, 2019 1:20 PM').getTime()
long endTimestamp = Date.parse(df, 'Jul 16, 2019 2:30 PM').getTime()
Jenkins.instance.getAllItems(AbstractItem.class).each {
builds = it.getBuilds().byTimestamp(startTimestamp, endTimestamp)
if(!builds.isEmpty()) {
return null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment