I have set of zip files that are in Artifact Repository and I need to get the latest artifact. The structure of the artefacts are as listed below
Homeloan
-> test-application-dev-local_1.zip
-> test-application-dev-local_2.zip
-> test-application-dev-local_3.zip
-> test-application-dev-local_4.zip
-> test-application-dev-local_5.zip
-> test-application-dev-local_6.zip
-> test-application-dev-local_7.zip
All these artefacts are an output of Msbuild. Everytime when the user checks-in their code it gets built in TeamCity and artefacts are uploaded to Jfrog.
Now I have a another TeamCity build which is triggered on adhoc basics which needs to get the latest artefact and in this case I need "test-application-dev-local_7.zip".
I'm using TeamcityArtifactory plugin to get artefacts and below is the spec I tried.
{
"files": [{
"aql": {
"items.find": {
"@build.name": "test-application-dev-local_*.zip"
}
},
"target": "somepath",
}]
}
With the above spec I get all the 7 zip files. I tried adding limit to the above spec(I'm not sure if this is the correct way) but I'm getting the error
{
"files": [{
"aql": {
"items.find": {
"@build.name": "test-application-dev-local_*.zip"
}
},
"limit":1
"target": "somepath",
}]
}
Error occurred while resolving dependencies from the spec: Unrecognized field "limit" (class org.jfrog.build.extractor.clientConfiguration.util.spec.Aql), not marked as ignorable (one known property: "items.find"])
I'm not sure how to retrieve the artefacts that was uploaded recently.
Even I was stuck at this , as the Artifactory documentation says -
"Currently sortBy, sortOrder, limit and offset are not supported in TeamCity."
So had to look around for any other way to implement these . What worked for me ?
->
I was able to do so by JFrog CLI command .
Had to recreate the spec file on command line and for sort and limit purpose , used the CLI command instead of adding sort and limit in the spec file .
echo ">>> Downloading the archive from artifactory ..."
echo "{" > downloadSpec.json
echo " \"files\": [" >>downloadSpec.json
echo " {" >> downloadSpec.json
echo " \"pattern\": \"artifactory-repo-path/artifact-name*.tar.gz\"," >> downloadSpec.json
echo " \"target\": \"target-path\-to-download"" >> downloadSpec.json
echo " }" >> downloadSpec.json
echo " ]" >> downloadSpec.json
echo "}" >> downloadSpec.json
jfrog rt dl --spec=downloadSpec.json
--url="your-artifactory-server-url" --user="your-artifactory-user-name" --
password="your-artifactory-password" --sort-by=updated --sort-order=desc
--limit=1
where jfrog rt dl
-> is the command to download
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.