Reputation: 3328
My intent is to store SNAPSHOT and RELEASE firmware binary images in Artifactory.
I have setup a custom repository layout where the artifact path pattern is set to -
[org]/[module]/[baseRev]-[folderItegRev]/[baseRev]-[folderItegRev](-[fileItegRev]).[ext]
Here are screenshots of the configuration -
I created a new repository based on the generic package type and chose the custom repository layout that I created.
I have uploaded release and snapshot artifacts to this repo and this is what it looks like on the web UI -
myrepo
mygroup/myartifactid
1.0.0-RELEASE
1.0.0-RELEASE.bin
2.0.0-RELEASE
2.0.0-RELEASE.bin
3.0.0-SNAPSHOT
3.0.0-SNAPSHOT-20170630161531.bin
3.0.0-SNAPSHOT-20171202161531.bin
3.0.0-SNAPSHOT-20171231161531.bin
Now if I use the REST API to search for the latest artifact based on layout as per the API published here
GET http://artifactory-server:8082/artifactory/api/search/latestVersion?g=mygroup&a=myartifactid&v=3.0.0-SNAPSHOT
I get the below response -
{
"errors": [
{
"status": 404,
"message": "Unable to find artifact versions"
}
]
}
What am I doing wrong? I want to be able to search for the latest release and snapshot versions using the REST API.
Upvotes: 2
Views: 1937
Reputation: 20376
Make sure that "Folder Integration Revision RegExp" and "File Integration Revision RegExp" are defined for your custom layout.
In the case of your layout, they should be:
Folder Integration Revision RegExp: SNAPSHOT
File Integration Revision RegExp:(?:[0-9]{14})
To make sure the layout is properly configured, test it against a sample path, for example: mygroup/myartifactid/3.0.0-SNAPSHOT/3.0.0-SNAPSHOT-20170630161531.bin
If everything is configured correctly the test result should show the various parts of the layout: organization, module etc.
In addition, it is better, in terms of performance, to specify which repositories you wish to query, for example:
GET http://localhost:8081/artifactory/api/search/latestVersion?g=mygroup&a=myartifactid&v=3.0.0-SNAPSHOT&repos=myrepo
Upvotes: 2