2

I want to search for a filename pattern across entire JFrog ARM without knowing the explicit repository name in the JFrog cli.

jfrog rt s "reponame/*pattern*"

is giving the results as expected in a specific repo.
But I have repo1, repo2, repo3, ... so on.
How do I search using wildcard for reponame, below is not working.

jfrog rt s "*/*pattern*"

Basically I want the jfrog cli equlivalent of the curl GET request search

"https://server/artifactory/api/search/artifact?name=*pattern*"
Dror Bereznitsky
  • 20,048
  • 3
  • 48
  • 57
sunil
  • 491
  • 4
  • 10
  • 1
    i am trying to figure it out as well, the best thing i can come up with is put your repositories in a variable ex `repos=repo1 repo2 repo3 ...` and loop through them `for repo in "$repos"; do jfrog rt s $repo/$pattern/; done` – niken Jun 09 '17 at 18:05
  • Infact I ended up doing exactly iterating over all repos in a forloop just as you. It is so bad their hyped CLI does not have such a facility using simple commands. – sunil Jun 13 '17 at 06:07
  • I haven't tested it out yet, but I have a feeling using REST API via curl -x POST or whatever is the better option (more user friendly, even the syntax looks cleaner) i may spend some time of this if i get anything worthwhile working I will post it here – niken Jun 13 '17 at 15:19

1 Answers1

-2

This is not for cli client, but an alternative way to get desired feature. Spent some time looking at API here:

https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API

I recommend to scroll down that page slowly and read in entirety as a lof of possible commands, syntax is excellent, I executed a few searches and they searched all local repositories. No need to recursively search 1 by 1. Command syntax:

 export url="http://url/to/articatory"
 curl --noproxy '*' -x GET "$url/api/search/artifact?name=log4j*"

Read link above for more granular search options/syntax.

How I set it up:

 alias artpost='curl -X POST "http://url/artifactory/api/search/aql" -T - -u admin:password'

Some example usage:

 echo 'items.find({"name": {"$match" : "log4j*"}})' | artpost
 echo 'items.find({"$and" : [{"created" : {"$gt" : "2017-06-12"}},{"name": {"$nmatch" : "*surefire*"}}]})' | artpost
niken
  • 2,499
  • 3
  • 33
  • 56
  • 1
    Did you read my question fully ? I wanted to know how to do it using jfrog cli client not curl. I already posted what you suggested in the question itself. jfrog releases a cli client if you are not aware of it. – sunil Jun 15 '17 at 16:31
  • Yes I read you question. You asked how to search for something. Did you read my answer? First words out: "This is not for cli client..." I posted it in case anyone else stumbles here and just wants to query using curl. I gave you a functional answer that works, without you specifying any restrictions in your question. – niken May 14 '20 at 20:18