Last active
December 20, 2022 04:05
-
-
Save daniilyar/bcfa3ceb40061c5ee08fe8b907c5e9b1 to your computer and use it in GitHub Desktop.
Jenkins groovy script: get all builds started during a specific time
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
// 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()) { | |
println(it.fullName) | |
println(builds) | |
} | |
} | |
return null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment