How to download previous build version ( a.b.c.d-1 ) if requested version ( a.b.c.d ) does not exist in artifactory.
Using Artiffactory plugin in Jenkins pipeline.
How to download previous build version ( a.b.c.d-1 ) if requested version ( a.b.c.d ) does not exist in artifactory.
Using Artiffactory plugin in Jenkins pipeline.
You can use Jfrog CLI in your pipeline to do this, you don't need Jenkins Artifactory Plugin.
You can define your pipeline to download the artifact version that you want and if you have an exception (don't exist) you can download another version.
The command for donwload an antifact is:
jfrog rt dl my-local-repo/your-artifact-a.b.c.d.zip
You can catch exceptions in your pipeline with this code:
stage('Your stage') {
try {
//Your code for Jfrog CLI
jfrog rt dl my-local-repo/your-artifact-a.b.c.d.zip
} catch (Exception err) {
//Your additional code
}
}
You can viisit the official page of Jfrog CLI: Jfrog CLI Downloading files
The only working version so far is to try to download server.download(downloadSpec) each artifact in a loop ( a.b.c.d-- ) and check if files appeared in the file system. Still looking for more elegant solution.