2
votes

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 - SNAPSHOT RELEASE

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.

1
When creating the layout, did you define the "Folder Integration Revision RegExp" and "File Integration Revision RegExp"? were you able to successfully test the layout against a given path? - Dror Bereznitsky
@DrorBereznitsky I have added screenshots, can you take a look? - thegreendroid
your layout looks good. I tested it in my local environment and I manage to get correct results from the REST API call. Do you have anu other special setup for the repository? which user are you using for the API call? which version of Artifactory? - Dror Bereznitsky
I am using a trial version of Artifactory Pro 5.4.1 rev 50054. I tried the API call using the anonymous and the admin user using the API token. Neither of them worked. - thegreendroid
Could I perhaps look at a log to diagnose what could be going wrong? - thegreendroid

1 Answers

2
votes

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.

enter image description here

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