Reputation: 23
I have a artifactory server with alot of content and alot of .zip-files. Artifactory supports archive search which allows you to search for specific files within the archives.
The problem is that when using the API you can only specify file name (or keyword) and repo. The problem is that the repo contains so much files that the maximum number of hits is reached. It's also not that efficient to search everything every time when I know the path to the interesting 10%.
Does anyone know if it's possible to search part of the repo using the API? Do I have to create virtual repos that points to a subset of the repo?
Any ideas appreciated!
Upvotes: 2
Views: 699
Reputation: 6043
The easiest and most efficient way to search and filter inside archive entries is using the JFrog CLI. With that, you can specify your search pattern and filter out unwanted results.
jfrog rt s <repository name>/<repository path> --archive-entries=<path-in-archive>
Example:
jfrog rt s generic-local/food/* --archive-entries=cheese/milk.txt
# Results: pizza.zip
You can also use File Specs for more complex queries:
Create filespec.json:
{
"files": [
{
"pattern": "generic-local/food/*",
"archiveEntries": "cheese/milk",
"exclusions": "*lasagne*"
},
{
"pattern": "thor/*",
"archiveEntries": "hammer"
}
]
}
Run the following:
jfrog rt s --spec=filespec.json
# Possible results: pizza.zip and weapon.zip
Notice: To use archive search, make sure "Archive Search Enabled" is checked under Administration
| Artifactory
| General Settings
.
Read more:
Upvotes: 1