Is there any way to sort and limit the number of artifacts while downloading artifacts using CLI for Jfrog Artifactory?
Example: if we have 100 artifacts in a single repo and I want to download only top 5 artifacts.
Thanks!
Is there any way to sort and limit the number of artifacts while downloading artifacts using CLI for Jfrog Artifactory?
Example: if we have 100 artifacts in a single repo and I want to download only top 5 artifacts.
Thanks!
Jfrog CLI currently does not support SORT and LIMIT. This is actually a roadmap item currently evaluated for Q4 17.
You can follow this Github issue to stay up-to-date with the implementation efforts.
for the meantime, you can use AQL with SORT and LIMIT over the JFrog REST API.
For example, the below AQL query Sorts by Descending creation dates and Limits the returned number of items to 5. it can be used as the body of a simple POST method:
items.find(
{
"repo":"my-repo-local"
}
).sort({"$desc" : ["created"]}).limit(5)
HTH,
Or
You can not limit the download to X number of artifacts using Jfrog Cli but there are 3 ways to "limit" your artifact donwload using Jfrog Cli.
These options are:
If you need only a specift artifact:
jfrog rt dl your-artifactory-local-repo/YOUR-ARTIFACT-NAME.EXTENSION
This example download the artifact named YOUR-ARTIFACT-NAME.EXTENSION from "your-artifactory-local-repo" to your local folder.
If you need all the artifact in a folder:
jfrog rt dl your-artifactory-local-repo/YOUR-ARTIFACT-FOLDER/ YOUR-LOCAL-FOLDER/
This example download all the artifacts from "your-artifactory-local-repo/YOUR-ARTIFACT-FOLDER/" to YOUR-LOCAL-FOLDER/
Using a regular expresion (best way):
Example 3.1:
jfrog rt dl "your-artifactory-local-repo/*" YOUR-LOCAL-FOLDER/
This command also download all the artifacts from "your-artifactory-local-repo/YOUR-ARTIFACT-FOLDER/" to YOUR-LOCAL-FOLDER/
Example 3.2:
jfrog rt dl "your-artifactory-local-repo/*.EXTENSION" YOUR-LOCAL-FOLDER/
This command also download all the .EXTENSION from "your-artifactory-local-repo/YOUR-ARTIFACT-FOLDER/" to YOUR-LOCAL-FOLDER/
Example 3.3:
jfrog rt dl "your-artifactory-local-repo/*SUBNAME.*" YOUR-LOCAL-FOLDER/
This command also download all the artifacts that ends with "SUBANME.*" from "your-artifactory-local-repo/YOUR-ARTIFACT-FOLDER/" to YOUR-LOCAL-FOLDER/
The best way is using regular expressions.