Hi,
I'm currently writing a script that should archive all the jobs that has'nt
been used for the last year, i couldn't find any command that should shelve
those jobs.
Any idea how to do that ?
Here is my script:
import hudson.model.*
jobs = hudson.model.Hudson.instance.items
Date date = new Date ()
currentTimeInMillis = date.getTime();
println "Today is " + date + " In MilSec " + currentTimeInMillis
def milSecondInSecond = 1000
def secondsInMinute = 60
def monutesInHour = 60
def secondsInHour = secondsInMinute*monutesInHour
def hoursInDay = 24
def minutesInDay = monutesInHour * hoursInDay
def secondsInDay = minutesInDay*secondsInMinute
def daysInYear = 365.242199
def hoursInYear = daysInYear*hoursInDay
def minutesInYear = hoursInYear*monutesInHour
def secondsInYear = minutesInYear*secondsInMinute
def milSecondsInYear = secondsInYear*milSecondInSecond
println "The milSeconds in year is " + milSecondsInYear
for (job in jobs) {
lastbuild = job.getLastBuild()
if (lastbuild != null) {
lastbuildInMilSeconds = lastbuild.getTimeInMillis()
def dif = currentTimeInMillis - lastbuildInMilSeconds
if (dif > milSecondsInYear) {
println job.getDisplayName() + " " + lastbuild.getTimeInMillis()
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.