Rename repository
Unforunately, It came to my knowledge that this repository promoted a phenomenon where DevOps interviews became a trivia game where people think it's normal to throw 20 random short questions like "what is fork()" or "which tools would you use for each of the following areas?" and this was not my intention. To explcitly state this repository doesn't represents real DevOps interview questions I've decided to rename it.
This commit is contained in:
6
exercises/jenkins/scripts/jobs_with_string.groovy
Normal file
6
exercises/jenkins/scripts/jobs_with_string.groovy
Normal file
@ -0,0 +1,6 @@
|
||||
def jobs = Jenkins.instance.items.findAll { job -> job.name =~ /"REMOVE_ME"/ }
|
||||
|
||||
jobs.each { job ->
|
||||
println job.name
|
||||
//job.delete()
|
||||
}
|
16
exercises/jenkins/scripts/old_builds.groovy
Normal file
16
exercises/jenkins/scripts/old_builds.groovy
Normal file
@ -0,0 +1,16 @@
|
||||
def removeOldBuilds(buildDirectory, days = 14) {
|
||||
|
||||
def wp = new File("${buildDirectory}")
|
||||
def currentTime = new Date()
|
||||
def backTime = currentTime - days
|
||||
|
||||
wp.list().each { fileName ->
|
||||
folder = new File("${buildDirectory}/${fileName}")
|
||||
if (folder.isDirectory()) {
|
||||
def timeStamp = new Date(folder.lastModified())
|
||||
if (timeStamp.before(backTime)) {
|
||||
folder.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user