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

qncylg1j  于 2023-01-08  发布在  Jenkins
关注(0)|答案(1)|浏览(197)

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

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

9w11ddsr1#

您可以在发布生成信息步骤期间配置生成保留:

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'
        )
    }
}

有关更多信息,请参见触发生成保留文档。

相关问题