Skip to content

Commit

Permalink
set pruneDeadBranches to false when without discarder
Browse files Browse the repository at this point in the history
  • Loading branch information
yudong2015 committed Nov 5, 2023
1 parent 6887f90 commit 10115f8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/client/devops/jenkins/pipeline_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,13 +434,15 @@ func createMultiBranchPipelineConfigXml(projectName string, pipeline *devopsv1al
appendMultiBranchJobTriggerToEtree(properties, pipeline.MultiBranchJobTrigger)
}

discarder := project.CreateElement("orphanedItemStrategy")
discarder.CreateAttr("class", "com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy")
discarder.CreateAttr("plugin", "cloudbees-folder")
if pipeline.Discarder != nil {
discarder := project.CreateElement("orphanedItemStrategy")
discarder.CreateAttr("class", "com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy")
discarder.CreateAttr("plugin", "cloudbees-folder")
discarder.CreateElement("pruneDeadBranches").SetText("true")
discarder.CreateElement("daysToKeep").SetText(pipeline.Discarder.DaysToKeep)
discarder.CreateElement("numToKeep").SetText(pipeline.Discarder.NumToKeep)
} else {
discarder.CreateElement("pruneDeadBranches").SetText("false")
}

triggers := project.CreateElement("triggers")
Expand Down

0 comments on commit 10115f8

Please sign in to comment.