I'm using the Jfrog Artifactory plugin in my Jenkins pipeline to pull some in-house utilities that the pipelines use. I specify which version of the utility I want using a parameter.
After executing the server.download, I'd like to verify and report which version of the file was actually downloaded, but I can't seem to find any way at all to do that. I do get a buildInfo object returned from the server.download call, but I can find any way to pull information from that object. I just get an object reference if I try to print the buildInfo object. I'd like to abort the build and send a report out if the version of the utility downloaded is incorrect.
The question I have is, "How does one verify that a file specified by a download spec is successfully downloaded?"
This functionality is only available on scripted pipeline at the moment, and is described in the documentation.
For example:
node {
def server = Artifactory.server SERVER_ID
def downloadSpec = readFile 'downloadSpec.json'
def buildInfo = server.download spec: downloadSpec
if (buildInfo.getDependencies().size() > 0) {
def localPath = buildInfo.getDependencies()[0].getLocalPath()
def remotePath = buildInfo.getDependencies()[0].getRemotePath()
def md5 = buildInfo.getDependencies()[0].getMd5()
def sha1 = buildInfo.getDependencies()[0].getSha1()
echo localPath
}
server.publishBuildInfo buildInfo
}