Closed DavidGamba closed 6 years ago
Thanks for sharing the need @DavidGamba We'll look into addidng sort and limit support in the future and as always, welcome a pull request from the community to help us deliver this.
@DavidGamba and @jgeorgeson, Version 1.12.0 added support for sort and limit, by adding sort-by, sort-order and limit both as command line options and File Spec properties. See the documentation for more information. We'd also appreciate your feedback for the new functionality.
Working nicely in my end!
For me it seems only to work as command line parameter but not in spec file.
@MichaelSiggelkowRnS, Can you please share with us the spec that you used? Does your spec include the new sort-by properly?
My spec file looks like
{ "files": [ { "pattern" : "repo/test/*", "sort-by" : "path", "sort-order" : "asc", "limit": 2 } ] }
which results on the debug output as
items.find({"repo": "repo","path": {"$ne": "."},"$or": [{"$and":[{"path": {"$match": "test"},"name": {"$match": "*"}}]},{"$and":[{"path": {"$match": "test/*"},"name": {"$match": "*"}}]}]}).include("name","repo","path","actual_md5","actual_sha1","size","type").limit(2)
Where as if I use the command line as
jfrog.exe rt s repo/test/* --sort-by "path" --sort-order "desc"
it resuls in the debug output as
items.find({"repo": "repo","path": {"$ne": "."},"$or": [{"$and":[{"path": {"$match": "test"},"name": {"$match": "*"}}]},{"$and":[{"path": {"$match": "test/*"},"name": {"$match": "*"}}]}]}).include("name","repo","path","actual_md5","actual_sha1","size","type").sort({"$desc":["path"]})
Thanks!
@MichaelSiggelkowRnS ,
thanks for your input!
We had a problem with our documentation. the correct format for the sort params in a spec file are: sortBy and sortOrder (as opposed to sort-by and sort-order).
We have fixed the documentation accordingly.
Please check and let us know if your problem is fixed.
Thanks again!
@ortsi Thanks a lot! That works for me now! One more question: Will this also be supported for Jenkins PlugIn? According to https://www.jfrog.com/confluence/display/RTF/Using+File+Specs file specs should work same way for jenkins and cli ... Thanks!
@MichaelSiggelkowRnS, Thanks for your feedback! Currently the sorting functionality is implemented in JFrog CLI only. We do however plan to implement this functionality in the build info project, which is used by the Jenkins, TeamCity and Bamboo Artifactory plugins. Since the File Spec schema of JFrog CLI and the other CI plugins may not always be identical, we'll modify the File Specs documentation page, so that it references the File Specs section which is specific to JFrog CLI.
@eyalbe4 Thank you for the update. I am really looking for a way that would allow to have one input format that could be used by CLI (for developer PCS) and by jenkins. So having one file spec format (and behaviour) would be much appreciated. Thanks!
Thank you all for the feedback. I think that this issue can be closed.
Currently, when using the CLI for artifactory I can't limit or sort my results. This is the command I am using:
jfrog rt s --spec=query-aql.json
I would like to be able to narrow down my results to one and then use the same spec to download the files with:
jfrog rt dl --spec=query-aql.json
Otherwise I need a high level language to parse the json output and filter stuff. But that is the purpose behind AQL, right?
Related stack overflow question: http://stackoverflow.com/q/44077569/1601989