Jenkins 和 JFrog Artifactory - 如何设置应存储多少个最后构建?

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

我正在使用 Artifactory 插件将 zip 包从 Jenkins 上传到 Artifactory。 我正在使用以下上传步骤并且它有效,我唯一的问题是可以以某种方式配置将在 Artifactory 中保留多少最后构建? (例如,最后 50 个版本)

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

谢谢

您可以在发布构建信息步骤中配置构建保留:

stage ('Set build retention') {
    steps {
        rtBuildInfo (
            maxBuilds: 50
        )
    }
}

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

stage ('Publish build info') {
    steps {
        rtPublishBuildInfo (
            serverId: 'Artifactory'
        )
    }
}

有关详细信息,请参阅 Triggering Build Retention 文档。