Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-17532

Latest Release Artifact API Doesn't Fetch Correct Release when there are multiple local repositories

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.12.0
    • Component/s: REST API
    • Labels:

      Description

      Currently, there's an issue when Retrieving Latest Artifact (Download the latest release artifact) CURL:

      https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-RetrieveLatestArtifact

      The jar file that is fetched is always from the local repository that's on top of the "Selected Repositories" list of the Virtual repository that it's contained in instead of fetching the latest version of the jar file if it's in a different local repository that's also in the same virtual repository.

      Expected behavior: 

      The latest release version of the jar should be fetched if there are multiple local repositories and not the version that is in a local repository that's at the top of the "Selected Repositories" of the virtual repository.

      Steps to reproduce:

      1. Create two Maven local repositories (IE: libs-release-local1, libs-release-local2)

      2. Create one Maven virtual repository (IE: libs-release-virtual)

      3. Add both Maven local repositories to the Maven virtual repository with libs-release-local1 on top of libs-release-local2 in "Selected Repositories" section

      4. Deploy Maven build release to libs-release-local1 first so it has a lower release number

      5. Deploy Maven build release to libs-release-local2 second so it has a higher release number

      6. Download Maven build jar from virtual repository using Retrieve Latest Artifact (Download the latest release artifact) CURL:

      GET http://localhost:8081/artifactory/ivy-local/org/acme/[RELEASE]/acme-[RELEASE].jar Behavior: The lower release version of the jar will always be fetched:

       Here is an example of the resolution logic using trace of where there are two version of the jar (demo-api-1.0.jar and demo-api-2.0.jar) and the REST API always returns the one located in the repository that's at the top of the "Selected Repositories" section even when there's a higher version in a different local repository

       

      curl "http://localhost:8081/artifactory/libs-release-virtual/org/jfrog/example/gradle/demo-api/\[RELEASE\]/demo-api-\[RELEASE\].jar?trace"
      Request ID: 96f07bbb
      Repo Path ID: libs-release-virtual:org/jfrog/example/gradle/demo-api/[RELEASE]/demo-api-[RELEASE].jar
      Method Name: GET
      User: anonymous
      Time: 2018-09-21T15:06:55.129-07:00
      Thread: http-nio-8081-exec-3
      Steps:
      2018-09-21T15:06:55.130-07:00 Received request
      2018-09-21T15:06:55.130-07:00 Request source = 0:0:0:0:0:0:0:1, Last modified = 31-12-69 15:59:59 -08:00, If modified since = -1, Thread name = http-nio-8081-exec-3
      2018-09-21T15:06:55.130-07:00 Executing any BeforeDownloadRequest user plugins that may exist
      2018-09-21T15:06:55.132-07:00 Retrieving info from {} repository '{}' type
      2018-09-21T15:06:55.132-07:00 Consulting the virtual repo download strategy
      2018-09-21T15:06:55.132-07:00 Trying to retrieve resource info from the local storage
      2018-09-21T15:06:55.133-07:00 Unable to find resource in libs-release-virtual:org/jfrog/example/gradle/demo-api/[RELEASE]/demo-api-[RELEASE].jar
      2018-09-21T15:06:55.133-07:00 Intercepting cached virtual resource with 'PomInterceptor'
      2018-09-21T15:06:55.133-07:00 Intercepting cached virtual resource with 'MavenMetadataInterceptor'
      2018-09-21T15:06:55.133-07:00 Intercepting cached virtual resource with 'BowerVirtualInterceptor'
      2018-09-21T15:06:55.133-07:00 Intercepting cached virtual resource with 'GemsInterceptor'
      2018-09-21T15:06:55.133-07:00 Intercepting cached virtual resource with 'HelmVirtualInterceptor'
      2018-09-21T15:06:55.133-07:00 Intercepting cached virtual resource with 'NpmSearchVirtualInterceptor'
      2018-09-21T15:06:55.133-07:00 Intercepting cached virtual resource with 'P2Interceptor'
      2018-09-21T15:06:55.133-07:00 Intercepting cached virtual resource with 'YumVirtualInterceptor'
      2018-09-21T15:06:55.133-07:00 Searching for info in aggregated repositories
      2018-09-21T15:06:55.133-07:00 Preparing list of aggregated repositories to search in
      2018-09-21T15:06:55.133-07:00 Appending the nested virtual repository 'libs-release-virtual'
      2018-09-21T15:06:55.133-07:00 Appending collective local repositories
      2018-09-21T15:06:55.133-07:00 Appending collective local cache repositories
      2018-09-21T15:06:55.133-07:00 Appending collective remote repositories
      2018-09-21T15:06:55.134-07:00 Intercepting info request with 'PomInterceptor'
      2018-09-21T15:06:55.134-07:00 Intercepting info request with 'MavenMetadataInterceptor'
      2018-09-21T15:06:55.134-07:00 Intercepting info request with 'BowerVirtualInterceptor'
      2018-09-21T15:06:55.134-07:00 Intercepting info request with 'GemsInterceptor'
      2018-09-21T15:06:55.134-07:00 Intercepting info request with 'HelmVirtualInterceptor'
      2018-09-21T15:06:55.134-07:00 Intercepting info request with 'NpmSearchVirtualInterceptor'
      2018-09-21T15:06:55.134-07:00 Intercepting info request with 'P2Interceptor'
      2018-09-21T15:06:55.134-07:00 Intercepting info request with 'YumVirtualInterceptor'
      2018-09-21T15:06:55.134-07:00 Processing request as a release resource
      2018-09-21T15:06:55.134-07:00 Searching for the resource within libs-release-local
      2018-09-21T15:06:55.141-07:00 Resource was found in libs-release-local
      2018-09-21T15:06:55.141-07:00 Resource is an exact match - returning
      2018-09-21T15:06:55.141-07:00 Returning resource as found in the aggregated repositories
      2018-09-21T15:06:55.141-07:00 Intercepting found resource with 'PomInterceptor'
      2018-09-21T15:06:55.141-07:00 Intercepting found resource with 'MavenMetadataInterceptor'
      2018-09-21T15:06:55.141-07:00 Intercepting found resource with 'BowerVirtualInterceptor'
      2018-09-21T15:06:55.141-07:00 Intercepting found resource with 'GemsInterceptor'
      2018-09-21T15:06:55.141-07:00 Intercepting found resource with 'HelmVirtualInterceptor'
      2018-09-21T15:06:55.141-07:00 Intercepting found resource with 'NpmSearchVirtualInterceptor'
      2018-09-21T15:06:55.141-07:00 Intercepting found resource with 'P2Interceptor'
      2018-09-21T15:06:55.141-07:00 Intercepting found resource with 'YumVirtualInterceptor'
      2018-09-21T15:06:55.141-07:00 Requested resource is found = true
      2018-09-21T15:06:55.141-07:00 Request is HEAD = false
      2018-09-21T15:06:55.141-07:00 Request is for a checksum = false
      2018-09-21T15:06:55.141-07:00 Target repository is not remote or doesn't store locally = true
      2018-09-21T15:06:55.142-07:00 Requested resource was not modified = false
      2018-09-21T15:06:55.142-07:00 Responding with found resource
      2018-09-21T15:06:55.142-07:00 Executing any AltResponse user plugins that may exist
      2018-09-21T15:06:55.142-07:00 Alternative response status is set to -1 and message to 'null'
      2018-09-21T15:06:55.142-07:00 Found no alternative content handles
      2018-09-21T15:06:55.142-07:00 Retrieving a content handle from target repo
      2018-09-21T15:06:55.142-07:00 The requested resource isn't pre-resolved
      2018-09-21T15:06:55.142-07:00 Target repository isn't virtual - verifying that downloading is allowed
      2018-09-21T15:06:55.142-07:00 Creating a resource handle from 'libs-release-local:org/jfrog/example/gradle/demo-api/1.0/demo-api-1.0.jar'
      2018-09-21T15:06:55.143-07:00 Identified requested resource as a file
      2018-09-21T15:06:55.143-07:00 Requested resource is an ordinary artifact - using normal content handle with length '849'
      2018-09-21T15:06:55.143-07:00 Executing any BeforeDownload user plugins that may exist
      2018-09-21T15:06:55.143-07:00 Responding with selected content handle
      2018-09-21T15:06:55.144-07:00 Request succeeded
      

       

       

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rotemk Rotem Kfir
              Reporter:
              marcb Marc Bui (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: