Skip to content

Adding 'discard old builds' feature #1

Description

@IRobL

I've been at this for a while and haven't gotten much traction, here's where I left off:

(add-multibranch-pipeline-job.groovy)

.
.
.
BuildRetentionBranchProperty buildRetentionBranchProperty = new BuildRetentionBranchProperty(
  new LogRotator( 4, 5, 3, 2)
)

NamedExceptionsBranchPropertyStrategy.Named nebrs_d = new NamedExceptionsBranchPropertyStrategy.Named("discard", buildRetentionBranchProperty)
NamedExceptionsBranchPropertyStrategy.Named[] nebpsa = [ nebrs_d ]

BranchProperty[] bpa = [buildRetentionBranchProperty]
NamedExceptionsBranchPropertyStrategy nebps = new NamedExceptionsBranchPropertyStrategy(bpa, nebpsa)
branchSource.setStrategy()

.
.
.

PersistedList sources = mbp.getSourcesList()
sources.clear()
sources.add(branchSource)

Thanks for sharing these script, btw!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions