在 Jenkins 管道中的 rtUpload 之后获取工件 URL

Get artifacts URL after rtUpload in Jenkins pipeline

我正在使用 jenkins artifactory 插件并使用 rtUpload 上传 tar 文件。 有没有办法在完成后获取工件 URI?

它确实将其打印为日志:

[Pipeline] rtUpload

17:01:50 [consumer_0] Deploying artifact: http://x.x.x.x:8081/artifactory/my-local/snapshot/mor_v.tar.gz.

此功能目前仅在脚本管道上可用,并在 documentation.

中进行了描述

例如:

node {
def server = Artifactory.server SERVER_ID
def uploadSpec = readFile 'uploadSpec.json'
def buildInfo = server.upload spec: uploadSpec

if (buildInfo.getArtifacts().size() > 0) {
    def localPath = buildInfo.getArtifacts()[0].getLocalPath()
    def remotePath = buildInfo.getArtifacts()[0].getRemotePath()
    def md5 = buildInfo.getArtifacts()[0].getMd5()
    def sha1 = buildInfo.getArtifacts()[0].getSha1()
    echo remotePath
}

server.publishBuildInfo buildInfo
}