简体   繁体   English

如何从 Jenkins pipeline artifactory plugin 下载 artifact md5 checksum

[英]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.

相关问题 如何使用 Curl 命令在没有插件的情况下将最新的工件从 jfrog Artifactory 存储库下载到 jenkins 声明管道? - How to download the LATEST artifact from jfrog Artifactory repository to jenkins declarative pipeline without plugin using Curl command? Jenkins-从Artifactory下载和计算得出的MD5校验和与原始文件不同 - Jenkins - Downloading from Artifactory and Calculated MD5 checksum is different from original Jenkins-Groovy-Jfrog Artifactory-下载工件时出现异常计算出的MD5校验和不同于原始 - Jenkins-Groovy - Jfrog Artifactory - getting exception while downloading artifacts Calculated MD5 checksum is different from original Jenkins Artifactory Plugin AQL下载最新神器匹配模式 - Jenkins Artifactory Plugin AQL download latest artifact matching pattern 如何使用 jenkins 管道从 nexus 下载最新的工件? - How to download latest artifact from nexus using jenkins pipeline? 从工件中选择工件以在Jenkins中部署管道作业 - choose artifact from artifactory to deploy pipeline job in Jenkins 如何为上传到 Jfrog Artifactory 的每个工件触发 Jenkins 管道构建 - How to trigger a Jenkins pipeline build for every artifact uploaded to Jfrog Artifactory 如何使用Artifactory插件和Credentials插件将Jenven的Maven工件部署到Artifactory时解决401失败? - How can I resolve a 401 failure when deploying a Maven artifact from Jenkins to Artifactory using the Artifactory Plugin and the Credentials Plugin? Jenkins 流水线:如何在 Jenkins 流水线的后期下载存档的工件 - Jenkins pipeline: how to download a archived artifact in a later stage in a Jenkins pipeline 使用Jenkins中的Artifactory插件有条件地从工件下载文件 - Use the Artifactory Plugin in Jenkins to conditionally download files from artifactory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM