[JobDSL plugin] Configure buildRetention in organizationFolder

40 views
Skip to first unread message

Bruno Galindro da Costa

unread,
Oct 27, 2022, 5:53:44 AM10/27/22
to Jenkins Users
How can I configure buildRetention in organizationFolder job type using JobDSL plugin? Is it supported?

I could easily do it in a multibranchPipelineJob but I didn't find a way to do it in organizationFolder.

This is how I did in multibranchPipelineJob:

multibranchPipelineJob('my-job') {
    branchSources {
        branchSource {
            strategy {
                allBranchesSame {
                    props {
                        buildRetention {
                            buildDiscarder {
                                strategy {
                                    logRotator {
                                        daysToKeepStr('3')
                                        numToKeepStr('5')
                                        artifactDaysToKeepStr('3')
                                        artifactNumToKeepStr('5')
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}


My env is:

Jenkins version: 2.346.3
JobDSL plugin version: 1.79
Reply all
Reply to author
Forward
0 new messages