Skip to content

Commit

Permalink
Do not delete branches that are not created by jenkins-build-per-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
hillebrand-eleven committed Jun 25, 2015
1 parent 2106c2a commit c4ab73f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/groovy/com/entagen/jenkins/JenkinsJobManager.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ class JenkinsJobManager {
deprecatedJobNames.each { String jobName ->

def shortenedJobName = jobName.substring(templateJobPrefix.length() + 1)
def safeBranchNameRegex = branchNameRegex.replaceAll("\\/", _)
println "Shortened jobName $shortenedJobName"
final def branchNameRegexMatches = shortenedJobName.matches(branchNameRegex)
println "safeBranchNameRegex $safeBranchNameRegex"
final def branchNameRegexMatches = shortenedJobName.matches(safeBranchNameRegex)
if (!noDelete && branchNameRegexMatches) {
println "Deleting deprecated job: $jobName"
jenkinsApi.deleteJob(jobName)
Expand Down

0 comments on commit c4ab73f

Please sign in to comment.