Hi everyone, here is an issue that I face. It is related to artifact versions and layouts. Shortly saying, in the layout test, the version is properly recognized (and also when you click on an artifact), but the "api/search/versions" and "api/search/lastVersion" do not recognize the fileItegRev part of the version.
I use Artifactory Pro Power Pack 3.2.2 (rev. 30097). It can also be that I defined the layout wrongly, therefore I want to give you here the background of the problem, detailed explanation and the step by step way how I created the layout. In my company we used the folowing naming convention for the artifacts produced internally within the company: /Company/Product/<major-version>/<minor-version>/Product-<major-version>-<minor-version>-<remark>.<extension> / Major and minor version consist only of numbers separated by dots. Remark can be any text. Here are some examples: /Company/Product1/2.2.4/4468/Product1-2.2.4-4468.zip/ /Company/Product2/1.1/672.0/Product2-1.1-672.0-Install.zip/ etc. The Company name is actually always the same. The layout used was the following: /[orgPath]/[module]/[baseRev](/[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext] / The search API worked as expected. Recently we introduced a new "NuGet-like" naming convention: /Company/Product/<major-version>/<minor-version>/*Company.*Product*.*<major-version>*.*<minor-version>*.*<remark>.<extension> /E.g. /Company/Product1/2.2.4/4468/*Company.*Product1*.*2.2.4*.*4468.zip/ /Company/Product2/1.1/672.0/*Company.*Product2*.*1.1*.*672.0*./*Install.zip The difference between conventions is minor - each artifact is now prefixed with the company name, and instead of hypens we use dots. My goal was to define a layout that would support both the old and the new convention at the same time. Here is how I built it, step-by-step. Since the company name does not contain any path I replaced [orgPath] with [org] and tried the following: /*[org]*/[module]/[baseRev](/[folderItegRev])/*([org].)*[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext] /As you can see, the [org] in the file name is optional. The layout worked in the layout test (the "org" part was properly recognized) if the file was prefixed with the company name, but not if it was not! E.g. /*Company*/Product1/2.2.4/4468/*Company.*Product1-2.2.4-4468.zip/ was properly parsed, but this was not: /*Company*/Product1/2.2.4/4468/Product1-2.2.4-4468.zip/ Finally, since the company name is actually hardcoded I opted for the following hack (using custom regex token): /*[org]*/[module]/[baseRev](/[folderItegRev])/*(organisationName<Company>].)*[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext] / The "org" part was now properly parsed in both above cases, when the file had the company name as prefix and when it didn't have it. The next step was to support both dots and hypens as separators at the same time. My first solution didn't work (the "separator" custom token appears two times in the layout): /[org]/[module]/[baseRev](/[folderItegRev])/([organisationName<Company].)[module][separator<[\.\-]>][baseRev](*[separator<[\.\-]>]*[fileItegRev])(.[classifier]).[ext] / The layout test wasn't able to parse anything any more. After doing this litle change, suddenly everything worked well (two tokens are introduced "separator1" and "separator2" although they are completely the same): /[org]/[module]/[baseRev](/[folderItegRev])/([organisationName<Company].)[module][separator1<[\.\-]>][baseRev]([separator*2*<[\.\-]>][fileItegRev])(.[classifier]).[ext] / *Layout tests were passing on all exmples that I tried.* So defined, layout was supporting both the old and the new notation. Passing means all the tokens, "org", "module", "baseRev", "fileItegRev" etc. were properly recognized. Here is a screenshot of the layout testing and the information displayed when the artifact is selected: <http://forums.jfrog.org/file/n7580146/Artifactory_Succesful_Test_Artifact_Path_Resolution_001.png> <http://forums.jfrog.org/file/n7580146/Artifactory_Succesful_Test_Artifact_Path_Resolution_002.png> Note that the version numbers are properly parsed in both cases (for the artifacts being named with both the old and the new convention). The next thing was to check if search for versions work as expected that means if it will respect both the new and the old notation at the same time. Unfortunately, this didn't work as expected. Only the first part of the version was returned, the "baseRev". The "fileItegRev" was always missing. E.g. <http://forums.jfrog.org/file/n7580146/Artifactory_Search_Result_Without_The_fileItegRev.png> I tried to figure out why and I stumbled upon the following sentence in the Artifactory documentation: "For integration search to work the repository layout requires an 'Artifact Path Pattern' that contains the baseRev token and then the fileItegRev token *with only literals between them*." (emphasized by me). So I tried to replace the "dot or hypen" regular expression between the "baseRev" and "fileItegRev" with a "hardcoded" hypen: [org]/[module]/[baseRev](/[folderItegRev])/([organisationName<Company].)[module][separator1<[\.\-]>][baseRev](*-*[fileItegRev])(.[classifier]).[ext] Suddenly everything was working fine with the search and the full version were properly returned.. But the layout does not support the both conventions any more :-( Does anyone has any idea why the version information is properly extracted out of the layout in the layout test and when an artifact is selected, but not in the search? Is there any better way to accomplish what I'm trying to accomplish (to support two slightly different naming conventions at the same time)? Any help will be much appreciated :-) Thanks! Best regards, Igor -- View this message in context: http://forums.jfrog.org/baseRev-and-fileItegRev-recognized-in-the-layout-test-but-not-in-search-tp7580146.html Sent from the Artifactory - Users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ New Year. New Location. New Benefits. New Data Center in Ashburn, VA. GigeNET is offering a free month of service with a new server in Ashburn. Choose from 2 high performing configs, both with 100TB of bandwidth. Higher redundancy.Lower latency.Increased capacity.Completely compliant. http://p.sf.net/sfu/gigenet _______________________________________________ Artifactory-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/artifactory-users
