Modify the structure of README.md
Instead of having exercises in their own separate section, they are now part of the main topics sections. This should make the learning process easier to follow where users have both exercises and questions in the same place. In addition, added a couple of new questions & exercises and modified existing scripts accordingly.
This commit is contained in:
16
exercises/jenkins/solutions/remove_builds_solution.groovy
Normal file
16
exercises/jenkins/solutions/remove_builds_solution.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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
6
exercises/jenkins/solutions/remove_jobs_solution.groovy
Normal file
6
exercises/jenkins/solutions/remove_jobs_solution.groovy
Normal file
@@ -0,0 +1,6 @@
|
||||
def jobs = Jenkins.instance.items.findAll { job -> job.name =~ /"test"/ }
|
||||
|
||||
jobs.each { job ->
|
||||
println job.name
|
||||
//job.delete()
|
||||
}
|
Reference in New Issue
Block a user