在Jenkins管道中rtUpload之后获取工件URL [英] Get artifacts URL after rtUpload in Jenkins pipeline
本文介绍了在Jenkins管道中rtUpload之后获取工件URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用jenkins人工插件,并使用rtUpload上传tar文件.完成后是否有办法获取工件URI?
Im using jenkins artifactory plugin and uploading tar file using rtUpload. Is there a way to get the artifact URI when it finished?
它确实将其打印为日志:
It does print it as a log :
[管道] rtUpload
[Pipeline] rtUpload
17:01:50 [consumer_0]部署工件: http://xxxx:8081/artifactory/my-local/snapshot/mor_v.tar.gz .
17:01:50 [consumer_0] Deploying artifact: http://x.x.x.x:8081/artifactory/my-local/snapshot/mor_v.tar.gz.
推荐答案
This functionality is only available on scripted pipeline at the moment, and is described in the 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
}
这篇关于在Jenkins管道中rtUpload之后获取工件URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文