1 changed file
jenkins_clear_build_history.groovy | ||
jenkins_clear_build_history.groovy
/jenkins_clear_build_history.groovy-1+5/jenkins_clear_build_history.groovy
Add comment 31 // XXX: Edit this to the name of your job pipeline
Add comment 32 String jobName = "My Dev Pipeline"
Add comment 33
Add comment 34 Plus // Simple Job
Add comment 34 35 //def job = Jenkins.instance.getItem(jobName)
Add comment 35 Minus // also handles Multibranch Pipelines
Add comment 36 Plus //
Add comment 37 Plus // XXX: must specify the branch for Multibranch Pipelines
Add comment 36 38 //def job = Jenkins.instance.getItemByFullName("$jobName/master")
Add comment 39 Plus //
Add comment 40 Plus // but this method can also handle simple jobs so use it for everything
Add comment 37 41 def job = Jenkins.instance.getItemByFullName(jobName)
Add comment 38 42
Add comment 39 43 // deletes the previous build history