How to write Pipeline to discard old builds?

前端 未结 9 795
暖寄归人
暖寄归人 2020-12-04 20:24

The groovy syntax generator is NOT working for sample step properties: Set Job Properties. I\'ve selected Discard old builds and then entered

9条回答
  •  情深已故
    2020-12-04 21:20

    You can use the properties method which, nested within the BuildDiscarderProperty eventually has the key you want to set. I still don't have a solid way to look up the correct syntax of each key. After much guessing and checking:

    properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10']]]);
    

    Note that this snippet is for scripted syntax.

提交回复
热议问题