I have an artifactory (generic) build in jenkins. It works very well for publishing but I'm having problems with what to write in the spec file for the "download" section.
I want my build to download the latest version of a file from another build. My repo layout is configured so that if I use a url like: http://artiserver:8081/artifactory/infra/package-scripts/[INTEGRATION]/scripts_archive.tar.gz I always get the most recent version of that file.
In the "download file" spec section of the generic artifactory integration job config I can write a spec file like so:
{
"files": [
{
"pattern": "infra/package-scripts/32/scripts_archive.tar.gz"
}
]
}
And this works as expected (always getting the 32
version of the artifact. I want to make the job depends on the latest version (ie, what i get from the INTEGRATION link) eg:
{
"files": [
{
"pattern": "infra/package-scripts/[INTEGRATION]/scripts_archive.tar.gz"
}
]
}
Is this possible? Or do I need my job to depend on a promoted build without the numbering?
--edit--
I've also tried:
{
"files": [
{
"aql": {
"items.find" : {
"repo": "infra",
"name": "scripts_archive.tar.gz",
},
"sort": { "$desc": [ "created" ] },
"limit": 1
}
}
]
}
But get syntax errors..
-- edit 2 --
Turns out I can't yet use sort/limit in jenkins spec file AQL - https://www.jfrog.com/jira/browse/HAP-832
In version 2.9.0 of the Jenkins Artifactory Plugin, the Download Spec schema was extended to include a new "build" property. This provides you an additional filtering of the downloaded files, so that they are the artifacts of a specific build. If you don't specify a specific build number, you'll get the artifacts of the latest build published to Artifactory. Please notice that the "build" property can provide the latest build and not the latest version, but if your builds publish build-info to Artifactory, then it actually provides the same outcome. Also note that the "pattern" property is still used when specifying the build.