I'm a little confused about the intent of this JIRA, so just hoping to get clarity and validate requirements, given the ubiquitous utilization of the git plugin. I also don't pretend to be an expert on Git, the git-plugin, nor regex.
PRESENT STATE: Status page and Git Build Data page show only the commit ref and the branch name.
Git supports a variety of connection types/protocols (git:, http(s):, ssh:, ftp(s):, file: ), and the path/to/repo may take various forms.
DESIRED STATE: Show the OrgName/RepoName. Or, given the nuances to come, [path/to/repo/]<repo_name>, or repo_url minus host_url;
This would be equivalent to the Jenkins JOB_URL, minus the JENKINS_URL, call it the REPO_FULLNAME with the GITHOST_URL removed.
I'd be interested in seeing the REPO_FULLNAME as just one of our instances connects to over 600 different repos on a variety of hosts.
I often find to click configure to get validate the repo (and get the link to navigate), but at least seeing the repo name would cut significant toil.
I am undecided whether an option to also show the GITHOST_NAME (not the GITHOST_URL) would be necessary to disambiguate.
Our hosts include GitHub, Gitlab, AzureDevOps Server/TFS (on-prem), Gogs some just file://, (markewaite has listed more (above), like Assembla and BitBucket). Azure DevOps Server nomenclature is actually:
http://tfs.mycorp.com/tfs/<TeamCollection>/<TeamProject>/_git/<RepoName>, so it's more than just <OrgName>/<Reponame>.
Some of our host servers end in an internal domain which is not (com|org), We also don't need to supply a FQDN either; HOST will suffice.
Thus the solution is more akin to: how to remove the HOST_URL given the wide variety of possible connection formats, not exclusively extract <OrgName>/<RepoName>.
Assume the displayed REPO_FULLNAME would exclude any ".git" extension and in the case of AzureDevOps,, the "/_git" separator.
The solution should be able to handle multiple GITHOST_URL for a given instance.
It should be able to handle all the scenarios described, plus any nuances other host applications might throw.
As admin, I also really don't want to have to maintain a regex property list for the users.
Not a regex expert, but this regex ".(:[^/]|@|\/\/)([^/])\/"works to match the leading GITHOST_URL portion for the examples Mark provided, except for the one without a Assembla one without slash (git@git.assembla.com:git-plugin.bin.git).
Any regex that strips the ending ".git" should not exclude a reponame ending in git (ie: https://github.com/git/git.git}}) or with git in the name (eg: https://github.com/git/git.github.io.git ) or other oddballs (eg: https://github.com/git/git-scm.com.git or http://tfs.mycorp.com/tfs/Collection/TeamProj/_git/automation_git; ). It should also properly handle the "/_git" or "/_ssh" MS throws at you.
Not 100% sure this helps add clarity or validate the requirements, but I hope it at least identified some gotchas.
(Removed clickable link remarks; seems it's a bad config / old instance my part).
I got the global configuration page.
I'll create an input tag which takes in the regex and then parses the url of the repository and display the Org Name/Repo name. The implementation can be tweaked based on the requirements.
I am referring this link for configuring jelly with jenkins.
Thank You