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

36 views
Skip to first unread message

gyaneshaprajjwal@gmail.com (JIRA)

unread,
Jan 29, 2020, 7:32:02 AM1/29/20
to jenkinsc...@googlegroups.com
Gyanesha Prajjwal commented on Improvement JENKINS-48822
 
Re: Make git plugin browser URL guessing clearer and easier to understand

I want to contribute on this issue. From where should I start ?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

mark.earl.waite@gmail.com (JIRA)

unread,
Jan 29, 2020, 7:46:02 AM1/29/20
to jenkinsc...@googlegroups.com

Thanks for your desire to contribute on this issue. That is wonderful!

I think you should take the following steps:

  1. Assign the issue to yourself and change its state to "In Progress" so that others know you are working on it
  2. Clone and compile the git plugin based on the contributing guide
  3. Identify the location in the code where Freestyle ("old style") jobs determine the browser is "no browser" and replace it with inference logic based on the repository URL
  4. Investigate if the GitStep can be extended to infer the browser class from the repository URL as well
  5. Define a Jenkins extension point for the browser inference logic

mark.earl.waite@gmail.com (JIRA)

unread,
Jan 29, 2020, 7:49:03 AM1/29/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Improvement JENKINS-48822
Thanks for your desire to contribute on this issue.  That is wonderful!

I think you should take the following steps:
# Assign the issue to yourself and change its state to "In Progress" so that others know you are working on it
# Clone and compile the [git plugin|https://plugins.jenkins.io/git] based on the [contributing guide|https://github.com/jenkinsci/git-plugin/blob/master/CONTRIBUTING.adoc#contributing-to-the-git-plugin]
# Identify the location in the
code [GitSCM constructor|https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java] where Freestyle ("old style") jobs determine the browser is "no browser" and replace it with inference logic based on the repository URL
# Investigate if the [GitStep|https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/jenkins/plugins/git/GitStep.java] can be extended to infer the browser class from the repository URL as well
# Define a [Jenkins extension point|https://jenkins.io/doc/developer/extensions/] for the browser inference logic

mark.earl.waite@gmail.com (JIRA)

unread,
Jan 29, 2020, 7:50:03 AM1/29/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Improvement JENKINS-48822
Thanks for your desire to contribute on this issue.  That is wonderful!

I think you should take the following steps:
# Assign the issue to yourself and change its state to "In Progress" so that others know you are working on it
# Clone and compile the [git plugin|https://plugins.jenkins.io/git] based on the [contributing guide|https://github.com/jenkinsci/git-plugin/blob/master/CONTRIBUTING.adoc#contributing-to-the-git-plugin]
# Identify the location in the [GitSCM constructor|https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java] where Freestyle ("old style") jobs determine the browser is "no browser" and replace it with inference logic based on the repository URL

# Investigate if the [GitStep|https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/jenkins/plugins/git/GitStep.java] can be extended to infer the browser class from the repository URL as well
# Define a [Jenkins extension point|https://jenkins.io/doc/developer/extensions/] for the browser inference logic inside the git plugin

mark.earl.waite@gmail.com (JIRA)

unread,
Jan 29, 2020, 7:54:04 AM1/29/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Improvement JENKINS-48822
Thanks for your desire to contribute on this issue.  That is wonderful!

I think you should take the following steps:
# Assign the issue to yourself and change its state to "In Progress" so that others know you are working on it
# Clone and compile the [git plugin|https://plugins.jenkins.io/git] based on the [contributing guide|https://github.com/jenkinsci/git-plugin/blob/master/CONTRIBUTING.adoc#contributing-to-the-git-plugin]
# Use the [Jenkins git-plugin gitter channel|https://gitter.im/jenkinsci/git-plugin] for conversations as you progress in the implementation
#
Identify the location in the [GitSCM constructor|https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java] where Freestyle ("old style") jobs determine the browser is "no browser" and replace it with inference logic based on the repository URL

# Investigate if the [GitStep|https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/jenkins/plugins/git/GitStep.java] can be extended to infer the browser class from the repository URL as well
# Define a [Jenkins extension point|https://jenkins.io/doc/developer/extensions/] for the browser inference logic inside the git plugin (see [Defining an extension point|https://wiki.jenkins.io/display/JENKINS/Defining+a+new+extension+point])
# Write automated tests to learn the code and to express what you've learned as code while making the changes

mark.earl.waite@gmail.com (JIRA)

unread,
Jan 29, 2020, 8:15:04 AM1/29/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Improvement JENKINS-48822
Thanks for your desire to contribute on this issue.  That is wonderful!

I think you should take the following steps:
# Assign the issue to yourself and change its state to "In Progress" so that others know you are working on it
# Clone and compile the [git plugin|https://plugins.jenkins.io/git] based on the [contributing guide|https://github.com/jenkinsci/git-plugin/blob/master/CONTRIBUTING.adoc#contributing-to-the-git-plugin]
# Use the [Jenkins git-plugin gitter channel|https://gitter.im/jenkinsci/git-plugin] for conversations as you progress in the implementation
# Identify the location in the [GitSCM constructor|https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java] where Freestyle ("old style") jobs determine the browser is "no browser" and replace it with inference logic based on the repository URL
# Investigate if the [GitStep|https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/jenkins/plugins/git/GitStep.java] can be extended to infer the browser class from the repository URL as well .  Do not be concerned if the GitStep is not readily modified or if changes to the GitStep are rejected. If is a legacy of the original pipeline implementation which has been superseded by the much more powerful checkout step
# Define a [Jenkins extension point|https://jenkins.io/doc/developer/extensions/] for the browser inference logic inside the git plugin (see [Defining an extension point|https://wiki.jenkins.io/display/JENKINS/Defining+a+new+extension+point])
# Write automated tests to learn the code and to express what you've learned as code while making the changes

mark.earl.waite@gmail.com (JIRA)

unread,
Jan 29, 2020, 8:40:02 AM1/29/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Improvement JENKINS-48822
Thanks for your desire to contribute on this issue.  That is wonderful!

I think you should take the following steps:
# Assign the issue to yourself and change its state to "In Progress" so that others know you are working on it
# Clone and compile the [git plugin|https://plugins.jenkins.io/git] based on the [contributing guide|https://github.com/jenkinsci/git-plugin/blob/master/CONTRIBUTING.adoc#contributing-to-the-git-plugin]
# Use the [Jenkins git-plugin gitter channel|https://gitter.im/jenkinsci/git-plugin] for conversations as you progress in the implementation
# Identify the location in the [GitSCM constructor|https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java] where Freestyle ("old style") jobs determine the browser is "no browser" and replace it with inference logic based on the repository URL
# Investigate if the [GitStep|https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/jenkins/plugins/git/GitStep.java] can be extended to infer the browser class from the repository URL as well.  Do not be concerned if the GitStep is not readily modified or if changes to the GitStep are rejected. If is a legacy of the original pipeline implementation which has been superseded by the much more powerful checkout step
#
Review [existing extension points|https://jenkins.io/doc/developer/extensions/git/] in the git plugin.  Likely best to model this one after [BuildChooser|https://javadoc.jenkins.io/plugin/git/hudson/plugins/git/util/BuildChooser.html]
# #
Define a [Jenkins extension point|https://jenkins.io/doc/developer/extensions/] for the browser inference logic inside the git plugin (see [Defining an extension point|https://wiki.jenkins.io/display/JENKINS/Defining+a+new+extension+point])

# Write automated tests to learn the code and to express what you've learned as code while making the changes

mark.earl.waite@gmail.com (JIRA)

unread,
Jan 29, 2020, 8:41:04 AM1/29/20
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Improvement JENKINS-48822
{color:red}colored text{color} Thanks for your desire to contribute on this issue.  That is wonderful!
# Define a [Jenkins extension point|https://jenkins.io/doc/developer/extensions/] for the browser inference logic inside the git plugin (see [Defining an extension point|https://wiki.jenkins.io/display/JENKINS/Defining+a+new+extension+point])

mark.earl.waite@gmail.com (JIRA)

unread,
Jan 29, 2020, 8:42:03 AM1/29/20
to jenkinsc...@googlegroups.com

gyaneshaprajjwal@gmail.com (JIRA)

unread,
Jan 29, 2020, 4:27:02 PM1/29/20
to jenkinsc...@googlegroups.com

gyaneshaprajjwal@gmail.com (JIRA)

unread,
Jan 29, 2020, 4:27:02 PM1/29/20
to jenkinsc...@googlegroups.com
Gyanesha Prajjwal started work on Improvement JENKINS-48822
 
Change By: Gyanesha Prajjwal
Status: Open In Progress

gyaneshaprajjwal@gmail.com (JIRA)

unread,
Feb 22, 2020, 9:29:02 AM2/22/20
to jenkinsc...@googlegroups.com

gyaneshaprajjwal@gmail.com (JIRA)

unread,
Feb 22, 2020, 9:59:02 AM2/22/20
to jenkinsc...@googlegroups.com

So, you mean I need to make certain changes, such that instead of "(Auto)" it should show the inferred browser repository in SCM.

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 22, 2020, 10:28:02 AM2/22/20
to jenkinsc...@googlegroups.com

Yes, I believe that will be one of the results of setting the browser in the constructor when the repository URL is a recognized URL.

The constructor would continue to be called with the same arguments it has today. Inside the constructor, there would be a call to decide if the repository URL is a recognized URL. That call would be an extension point which is used by the git plugin to register the recognized URLs. Since it would be an extension point, other plugins could add their own recognized URLs without requiring changes to the git plugin.

There is a page that describes how to define a new extension point. Refer to the current Jenkins extension points for possible reference implementations. The RepositoryBrowser is an extension point that is implemented in the git plugin repository browsers. I've never created a new extension point, so this will be a learning experience for me as well.

gyaneshaprajjwal@gmail.com (JIRA)

unread,
Feb 23, 2020, 2:32:03 PM2/23/20
to jenkinsc...@googlegroups.com

In GitSCM, there is a method guessBrowser() that is capable of inferring the repository browser. It has also been used in GitSCMBrowserTest.

Can that be used for our purpose?

gyaneshaprajjwal@gmail.com (JIRA)

unread,
Feb 23, 2020, 2:39:02 PM2/23/20
to jenkinsc...@googlegroups.com
Gyanesha Prajjwal edited a comment on Improvement JENKINS-48822
In GitSCM, there is a method guessBrowser() that is capable of inferring the repository browser (with the help of regex using the url ) . It has also been used in GitSCMBrowserTest.


Can that be used for our purpose?

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 23, 2020, 2:47:02 PM2/23/20
to jenkinsc...@googlegroups.com

The guessBrowser() method is adequate for the current implementation but would need to be extended to fit with the idea that was suggested by Stephen Connolly. The guessBrowser() method is not part of an extension point, so other plugins cannot register their own implementations. Thus, the Gitea plugin (today) is not allowed to provide its own repository browser implementation which would appear with other repository browser choices.

The guessBrowser() implementation could iterate over the implementations of an extension point, asking each implementation if it would like to provide a repository browser for the current repository URL.

The Jenkins concept of an extension point allows one plugin (Git plugin in this case) to provide a location which other plugins may implement to provide a repository browser.

gyaneshaprajjwal@gmail.com (JIRA)

unread,
Feb 23, 2020, 2:59:02 PM2/23/20
to jenkinsc...@googlegroups.com

What should be features of the extension point which will be created ( apart from inferring the browser ) ?

gyaneshaprajjwal@gmail.com (JIRA)

unread,
Feb 23, 2020, 3:02:02 PM2/23/20
to jenkinsc...@googlegroups.com
Gyanesha Prajjwal edited a comment on Improvement JENKINS-48822
What should be features of the extension point which will be created ( apart from inferring the browser ) ?   Will it be like one of those in hudson.plugins.git.extensions.impl ?

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 23, 2020, 5:56:03 PM2/23/20
to jenkinsc...@googlegroups.com

I assume that the extension point would need a method that would be passed the repository URL and would either return an instance of GitRepositoryBrowser or null. The null return would mean that the extension rejected the request to provide a browser, while if the GitRepositoryBrowser was returned, then that would be the inferred browser.

Word of warning: I'm inexperienced in this part of the Jenkins ecosystem, so we may need to discuss it with others that are more experienced. Francisco Fernández and rsandell do you have other guidance to offer?

gyaneshaprajjwal@gmail.com (JIRA)

unread,
Feb 23, 2020, 11:33:02 PM2/23/20
to jenkinsc...@googlegroups.com

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. 

gyaneshaprajjwal@gmail.com (JIRA)

unread,
Feb 24, 2020, 1:43:03 PM2/24/20
to jenkinsc...@googlegroups.com

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.

Reply all
Reply to author
Forward
0 new messages