Bug 1428034 - Enable gerrit to convert github issue reference as a hyperlink
Summary: Enable gerrit to convert github issue reference as a hyperlink
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: project-infrastructure
Version: mainline
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nigel Babu
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-01 18:21 UTC by Shyamsundar
Modified: 2017-03-20 07:35 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-20 07:35:47 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Shyamsundar 2017-03-01 18:21:51 UTC
Gluster intends to move to github to track features being delivered against the code base.

Read the announcement here: http://lists.gluster.org/pipermail/gluster-devel/2017-February/052203.html

Specifics of the github process here: https://hackmd.io/s/BkgH8sdtg#

Towards the above the following change is requested:
----------------------------------------------------
    Like gerrit provides in the BUG value a link to bugzilla, is it possible to provide a link to an github issue when that is referenced in the commit message? That would be quite nice, instead of having to form the URL every time

    Example from the go gerrit site: https://go-review.googlesource.com/#/c/37148/

Comment 1 Nigel Babu 2017-03-03 05:44:57 UTC
This should do the trick when added to the Gerrit config.

So we'll need to do

Fixes: gluster/glusterfs#12345
Fixes: gluster/glusterfs-specs#12345



[commentlink "githublink"]
     match = ([a-zA-Z0-9\-]+)\/([a-zA-Z0-9\-]+)#([0-9]*)
     link = "https://github.com/$1/$2/issues/$3

Comment 2 Nigel Babu 2017-03-03 06:34:33 UTC
Actual config that worked on stage:

[commentlink "githublink"]
    match = "([a-zA-Z\\d\\-]+)/([a-zA-Z\\d\\-]+)#(\\d+)"
    link = "https://github.com/$1/$2/issues/$3"

This will need a Gerrit restart, so it'll take a few days to make it in.

Comment 3 Niels de Vos 2017-03-03 07:39:54 UTC
Because we now get into a mix of numbers pointing to either Bugzilla or GitHub, I suggest to have the "BUG: 012345" replaced by URLs. The same approach needs to be done for GitHub issues. For someone reading the commit messages, a single well known source for bug reports and RFEs is easy, when we have two it will become confusing for many.

If replacing the "BUG: .." is tricky, it may be easier to add a "Reported-on: https://bugzilla.redhat.com/1428032" and "Reported-on: https://github.com/....". matching the existing scheme for "Reviewed-on:".

Comment 4 Shyamsundar 2017-03-03 14:42:28 UTC
(In reply to Niels de Vos from comment #3)
> Because we now get into a mix of numbers pointing to either Bugzilla or
> GitHub, I suggest to have the "BUG: 012345" replaced by URLs. The same

We do not get a mix of numbers, we get BUG:12345 as BZ link, and get Fixes #n or Updates #n (or Fixes gluster/glusterfs#n or Updates gluster/glusterfs#12) as github links. This maybe an example of the same (as Nigel is playing with it), https://gerrit-stage.rht.gluster.org/#/c/16405/8

> approach needs to be done for GitHub issues. For someone reading the commit
> messages, a single well known source for bug reports and RFEs is easy, when
> we have two it will become confusing for many.

Agreed, this is elegant, BUT I want this functionally ready soon,
and optimized later. If both can be done at the same time by Nigel, or the approach that you suggest is the one we take now or in the future, I leave to Nigel.

What is currently (being) done by Nigel is sufficient to get started and take to collaborators out there, and hence I would not like to delay that.

Comment 5 Nigel Babu 2017-03-15 05:18:15 UTC
Shyam, take a look at this when you get some time -> https://review.gluster.org/#/c/16901/ (It's a draft and you're CC'd. Need to be logged in to see)

Comment 6 Shyamsundar 2017-03-15 19:04:34 UTC
(In reply to Nigel Babu from comment #5)
> Shyam, take a look at this when you get some time ->
> https://review.gluster.org/#/c/16901/ (It's a draft and you're CC'd. Need to
> be logged in to see)

Checked the above and here are some questions:

1) We want the commit message to read "Fixes: #n" OR "Fixes: gluster/glusterfs#n" OR "Updates: #n" OR "Updates: gluster/gusterfs#n". Will the link substitution work for all of the above?

2) When a repo name is not mentioned in the commit message when referencing an issue # (for example: "Updates: #n") the default is gluster/glusterfs is the thought.
I understand that later, some other repositories that end up using the same scheme, will have trouble if so, but we want this as the default for the glusterfs repo, so this is a repo specific default, IOW, a commit against repo <name> with no repo reference in the issue #, automatically becomes a link to an issue against that repo <name>

3) Just stating, we will not reference any issue in gluster-specs, we will submit patches to specs that refer to issues in glusterfs repo, like "Updates: gluster/glusterfs#n"

4) I think we should also enforce (if this is the right layer to do it), that either a Fixes/Updates keyword is present before the issue reference.

Comment 7 Nigel Babu 2017-03-20 07:35:47 UTC
1) The link substitution will work for all mentions of #n or something/something#n. I may not be catching all the cases of something in the regex, but I should catch the practical ones for us. I does not force you to write Fixes: #n or Updates: #n. That can be enforced separately (git-branch-and-bug job?)

2) This is now done. See https://review.gluster.org/#/c/16901/

3) I've copied the config over to glustefs-specs too.

4) I don't think this is the right layer to enforce it. This is just doing a regex match and linking for convenience. Can't do much enforcing here.


Note You need to log in before you can comment on or make changes to this bug.