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

Make git plugin browser URL guessing clearer and easier to understand

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None

      Git plugin versions prior to git plugin 3.7.0 will infer the browser URL if the repository URL is a github.com URL. Git plugin 3.7.0 added browser URL inference for bitbucket.org and gitlab.com URL's.

      Stephen Connolly suggested that it would be clearer if the inference were made apparent to the user, rather than being hidden inside the plugin logic. He suggested:

      1. For regular SCM in old-style jobs... if you see the url as well-known, and the user has not configured a browser, then replace their no-browser with the well-known one in the constructor
      2. We don't need to do anything for SCMSource impls as they have their own pre-configured subclasses that do the right thing
      3. For the `git` pipeline step, have it do the inference and log the inference to the build log
      4. Make the inference logic an ExtensionPoint

          [JENKINS-48822] Make git plugin browser URL guessing clearer and easier to understand

          Sorry, even I am new to this and I can't suggest anyone here. But I would love to contribute to this part of Jenkins. 

          Gyanesha Prajjwal added a comment - Sorry, even I am new to this and I can't suggest anyone here. But I would love to contribute to this part of Jenkins. 

          Sir, I have made a pull request by adding only an extension point for inferring browser. I haven't made any additional changes. Kindly look into this and suggest the required changes and other steps which I need to take.

          Gyanesha Prajjwal added a comment - Sir, I have made a pull request by adding only an extension point for inferring browser. I haven't made any additional changes. Kindly look into this and suggest the required changes and other steps which I need to take.

          Hrushi20 added a comment - - edited

          Hey! Can I get an overview regarding the this issue. I don't understand what is an extension point? I realized that the browser is already being detected by Jenkins using the auto mode. So what should be the final output at the end of solving this issue?

           

          Hrushi20 added a comment - - edited Hey! Can I get an overview regarding the this issue. I don't understand what is an extension point? I realized that the browser is already being detected by Jenkins using the auto mode. So what should be the final output at the end of solving this issue?  

          Kalle Niemitalo added a comment - hrushi20 , please see https://www.jenkins.io/doc/developer/extensibility/ and https://javadoc.jenkins-ci.org/hudson/Extension.html for information about extension points.

          Hrushi20 added a comment - - edited

          I created the an Extension implementing the Extension point. This extension contains the method which takes in a string and returns the GitRepositoryBrowser object. How do I register this extension with the GitSCM?

          Hrushi20 added a comment - - edited I created the an Extension implementing the Extension point. This extension contains the method which takes in a string and returns the GitRepositoryBrowser object. How do I register this extension with the GitSCM?

          Make the Git plugin call Jenkins.getExtensionList (javadoc) and ask each extension in the ExtensionList to infer the browser, until one of them succeeds or all of them have been tried.

          Kalle Niemitalo added a comment - Make the Git plugin call Jenkins.getExtensionList ( javadoc ) and ask each extension in the ExtensionList to infer the browser, until one of them succeeds or all of them have been tried.

          Hrushi20 added a comment -

          Thanks. I'll try that. Also I created a pull request where I created the extension.
          https://github.com/jenkinsci/git-plugin/pull/1251

          Hrushi20 added a comment - Thanks. I'll try that. Also I created a pull request where I created the extension. https://github.com/jenkinsci/git-plugin/pull/1251

          Hrushi20 added a comment -

          `Jenkins.getExtensionList` is not a static method. However, there is a method `Jenkins.get().getExtensionList()` which is used to get the desired Extension.

          Hrushi20 added a comment - `Jenkins.getExtensionList` is not a static method. However, there is a method `Jenkins.get().getExtensionList()` which is used to get the desired Extension.

          HelloWorld added a comment -

          Hello , I kindly ask to work on this issue .
          Here is how Iam going to approach the issue :please correct me
          1- Modify the constructor in GitSCM Class to infer the browser URL if none is provided and the repository URL is from a well-known host.
          2-Implement the inference logic as an ExtensionPoint.
          3- Modify GitStep Class to log the inference.

          HelloWorld added a comment - Hello , I kindly ask to work on this issue . Here is how Iam going to approach the issue :please correct me 1- Modify the constructor in GitSCM Class to infer the browser URL if none is provided and the repository URL is from a well-known host. 2-Implement the inference logic as an ExtensionPoint. 3- Modify GitStep Class  to log the inference.

          Mark Waite added a comment -

          sirine707 based on the past experiences of others, I suggest that you choose another issue. Implementing an extension point is not well-suited to a new contributor.

          Mark Waite added a comment - sirine707 based on the past experiences of others, I suggest that you choose another issue. Implementing an extension point is not well-suited to a new contributor.

            Unassigned Unassigned
            markewaite Mark Waite
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: