Home > Enterprise >  Jenkins and JFrog Artifactory - how to set how many last builds should be stored?
Jenkins and JFrog Artifactory - how to set how many last builds should be stored?

Time:11-19

I am uploading zip packages from Jenkins to Artifactory using the Artifactory Plugin. I am using the following Upload step and it works, my only question is it possible to somehow configure how many last builds will be kept in Artifactory? (e.g. last 50 builds)

    stage ('Upload stage') {
        steps {
            rtUpload (
                serverId: 'Artifactory',
                spec: '''{
                      "files": [
                        {
                          "pattern": "package-*.zip",
                          "target": "artifactory/jenkins/"
                        }
                     ]
                }''',
            )
        }
    }

Thanks

CodePudding user response:

You can configure build retention during the publish build info step:

stage ('Upload stage') {
    steps {
        rtUpload (
            serverId: 'Artifactory',
            spec: '''{
                  "files": [
                    {
                      "pattern": "package-*.zip",
                      "target": "artifactory/jenkins/"
                    }
                 ]
            }'''
        )
    }
}
stage ('Publish build info') {
    steps {
        rtPublishBuildInfo (
            serverId: 'Artifactory',
            maxBuilds: 50
        )
    }
}

For more information see Triggering Build Retention documentation.

  • Related