[英]How to download the artifact md5 checksum from Jenkins pipeline artifactory plugin
When I download a gz file from artifactory in Jenkins pipeline, I would like to verify the md5 checksum to validate the download.当我在 Jenkins 管道中从 artifactory 下载 gz 文件时,我想验证 md5 校验和以验证下载。 While I can see the checksum in artifactory UI, I am not finding a way to download the same in Jenkins pipeline.
虽然我可以在 artifactory UI 中看到校验和,但我找不到在 Jenkins 管道中下载相同校验和的方法。
I am using the following piece of code to download and it downloads fine.我正在使用以下代码下载并且下载正常。
script {
def server = Artifactory.server '<myserver>'
def downloadSpec = """{
"files": [
{
"pattern": "<my artifact>.tar.gz",
"target": "tmp/"
}
]
}"""
server.download(downloadSpec)
}
When I upload the and the.md5, the artifactory uses the md5 to just validate against its own checksum but does not store the md5 as a separate file.当我上传 the 和 the.md5 时,artifactory 使用 md5 来验证它自己的校验和,但不会将 md5 存储为单独的文件。
I have perused the plugin documentation at https://www.jfrog.com/confluence/display/RTF/Jenkins+Artifactory+Plug-in and the REST API https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API and neither describes a way to donwload the checksum.我在https://www.jfrog.com/confluence/display/RTF/Jenkins+Artifactory+Plug-in和 REST API https://www.jfrog.com/confluence/display/RTF/仔细阅读了插件文档Artifactory+REST+API都没有描述下载校验和的方法。
Appreciate any help感谢任何帮助
Use this in jenkins pipeline:在詹金斯管道中使用它:
-> sh 'md5sum <filepath> | awk \'{print $1}\''
to create an MD5 hashcheck for your file.为您的文件创建 MD5 哈希检查。
Reference : cmd and shell script参考:cmd和shell脚本
Thanks谢谢
Change your server.download(downloadSpec)
line to read:将您的
server.download(downloadSpec)
行更改为:
buildInfo = server.download(downloadSpec)
for ( dep in buildInfo.getDependencies() ) {
md5 = dep.getMd5()
// ...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.