Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-36364

Artifactory DSL set discardOldBuilds to true in multibranch pipeline Jenkinsfile

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • artifactory-plugin
    • None

      I am working on implementing a build job using Jenkins Multibranch Pipelines. The final stage is uploading the build output to Artifactory.

      When configuring a standalone job via the interface, there is an option to "Discard old builds from Artifactory" which allows me to only keep the same number of builds as specified in "Max # of builds to keep" setting.

      A "normal" DSL job can be configured like this https://issues.jenkins-ci.org/browse/JENKINS-29856, but I haven't been able to figure out how to set discardOldBuilds to true in my multibranch pipeline Jenkinsfile.

      The upload stage in my Jenkinsfile is configured like this: https://wiki.jenkins-ci.org/display/JENKINS/Artifactory+-+Working+With+the+Pipeline+Jenkins+Plugin

      ... and I also have the following in my Jenkinsfile which does clean-up the builds in the Jenkins workspace:

      properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '10']]])

      Assuming (maybe wrongfully) that this is a limitation of the current pipeline artifactory DSL and it's currently not possible to set discardOldBuilds to true, would it be possible to have this feature added to the roadmap? If not, I would be very open to any and all enlightening initiatives.

            eyalbe Eyal Ben Moshe
            razvan_botez Razvan Botez
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: