Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63539

Git tool chooser does not recognize all existing caches

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.235.5
      Git plugin 4.4.0
    • Similar Issues:
    • Released As:
      git plugin 4.4.3

      Description

      The git tool chooser will use locally cached copies of git repositories to estimate repository size. However, the cache lookup uses the repository URL as the cache lookup key. Git repositories on all major providers can be accessed from multiple URLs where the different URLs represent the same repository.

      For example, https://github.com/jenkinsci/git-plugin and https://github.com/jenkinsci/git-plugin.git are the same repository but cache lookup by the repository URL will find at most one of those two.

      Should extend the repository cache lookup process to better use the cached copies.

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment - - edited

          PR-947 needs to be discarded and reworked into something better as a new pull request. The mistakes I made in that pull request include:

          • Should have started with an in-memory caching ConcurrentHashMap that uses a "normalized repository URL" as its key and stores the repository size
          • Should have created a lookup method that takes the repository URL, converts it to normalized repository repository URL format, then finds that in the cache
          • Should have created a cache assignment method that takes the repository URL, converts it to normalized repository URL format, then stores the size of the repository if the size is larger than the size (optionally) stored in that cache entry already
          • Should have used the cache lookup method inside the GitToolChooser code prior to reading any other sources. If size is found in cache, use it
          • Should have used the cache assignment method to record the non-zero results from a repository lookup

          The code that looks for caches on the Jenkins controller by different repository URL variants is likely still useful, since the user may have defined a multibranch repository using an alternate form. However, by checking the cache in memory first, we may avoid most of the work checking different forms of repository URL to see if a cache exists for that URL.

          Show
          markewaite Mark Waite added a comment - - edited PR-947 needs to be discarded and reworked into something better as a new pull request. The mistakes I made in that pull request include: Should have started with an in-memory caching ConcurrentHashMap that uses a "normalized repository URL" as its key and stores the repository size Should have created a lookup method that takes the repository URL, converts it to normalized repository repository URL format, then finds that in the cache Should have created a cache assignment method that takes the repository URL, converts it to normalized repository URL format, then stores the size of the repository if the size is larger than the size (optionally) stored in that cache entry already Should have used the cache lookup method inside the GitToolChooser code prior to reading any other sources. If size is found in cache, use it Should have used the cache assignment method to record the non-zero results from a repository lookup The code that looks for caches on the Jenkins controller by different repository URL variants is likely still useful, since the user may have defined a multibranch repository using an alternate form. However, by checking the cache in memory first, we may avoid most of the work checking different forms of repository URL to see if a cache exists for that URL.

            People

            Assignee:
            rishabhbudhouliya Rishabh Budhouliya
            Reporter:
            markewaite Mark Waite
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: