Quantcast
Viewing all articles
Browse latest Browse all 49

Answer by blacktide for How to write Pipeline to discard old builds?

If you're using the Jenkins Job DSL to create a job or pipelineJob, you can use any of the following formats to add the discard builds configuration to your job:

Option 1

This option modifies the XML structure of the job directly.

pipelineJob {  configure {    it / 'properties' / 'jenkins.model.BuildDiscarderProperty' {      strategy {'daysToKeep'('7')'numToKeep'('10')'artifactDaysToKeep'('-1')'artifactNumToKeep'('-1')      }    }  }}

Option 2

pipelineJob {  logRotator(7, 10, -1, -1)}

Option 3

pipelineJob {  logRotator {    numToKeep(10)    daysToKeep(7)    artifactNumToKeep(-1)    artifactDaysToKeep(-1)  }}

See the following links for additional details:


Viewing all articles
Browse latest Browse all 49

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>