2
votes

When I download a gz file from artifactory in Jenkins pipeline, I would like to verify the md5 checksum to validate the download. While I can see the checksum in artifactory UI, I am not finding a way to download the same in Jenkins pipeline.

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.

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.

Appreciate any help

1

1 Answers

0
votes

Use this in jenkins pipeline:

-> sh 'md5sum  <filepath> | awk \'{print $1}\''

to create an MD5 hashcheck for your file.

Reference : cmd and shell script

Thanks