Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/pkgsite: linking to source code in GitHub Enterprise Server #48542

Closed
sfllaw opened this issue Sep 22, 2021 · 5 comments
Closed

x/pkgsite: linking to source code in GitHub Enterprise Server #48542

sfllaw opened this issue Sep 22, 2021 · 5 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. pkgsite

Comments

@sfllaw
Copy link
Contributor

sfllaw commented Sep 22, 2021

#40477 suggests that we ask for new internal.source.patterns to support new code hosts.

We are using GitHub Enterprise Server which is hosted in a github.* domain. Currently, pkgsite is unable to resolve code from these repos because it only matches github.com: https://go.googlesource.com/pkgsite/+/5c86378aae4c9aeaf522db7e0a3b312d079f8c3e/internal/source/source.go#638

There is an existing model of self-hosted code repositories illustrated by gitlab.*. I suggest that we add something similar:

	{
		// Assume that any site beginning with "github." works like github.com.
		pattern:   `^(?P<repo>github\.[a-z0-9A-Z.-]+/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)(\.git|$)`,
		templates: githubURLTemplates,
	},

The downside to this approach is that people using other domain names will not be supported by this pattern, but I suspect the vast majority of people running GitHub Enterprise Server are using the github. subdomain.

@gopherbot gopherbot added this to the Unreleased milestone Sep 22, 2021
@jamalc jamalc added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 22, 2021
@jamalc jamalc modified the milestones: Unreleased, pkgsite/unplanned Sep 22, 2021
@jba jba added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Sep 22, 2021
@jba
Copy link
Contributor

jba commented Sep 22, 2021

Sounds reasonable.

@jba
Copy link
Contributor

jba commented Sep 22, 2021

Can you give me a URL to a file for testing? (We will hit it once and then record it for future tests, so the traffic will be minimal.)

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/351276 mentions this issue: internal/source: support github.* URLs

@sfllaw
Copy link
Contributor Author

sfllaw commented Sep 23, 2021

@jba Sorry, we don’t expose our GitHub Enterprise instance to the world, nor do we expose our Pkg.go.dev instance, because of corporate reasons. 🙁

However, I have applied your patch and used go run ./devtools/cmd/seeddb -seed internal-repos.txt -refetch to refetch everything in our database.

I can confirm that the Repository URL is now being properly detected. 🎉

gopherbot pushed a commit to golang/pkgsite that referenced this issue Sep 24, 2021
These URLs are used by some GitHub Enterprise Server customers.

For golang/go#48542

Change-Id: Iace7e9db14fcb776669c2ae581a7508c188c1aca
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/351276
Trust: Jonathan Amsterdam <[email protected]>
Run-TryBot: Jonathan Amsterdam <[email protected]>
TryBot-Result: kokoro <[email protected]>
Reviewed-by: Jamal Carvalho <[email protected]>
@sfllaw
Copy link
Contributor Author

sfllaw commented Sep 29, 2021

:shipit: 🎉

@sfllaw sfllaw closed this as completed Nov 5, 2021
@rsc rsc unassigned jba Jun 23, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. pkgsite
Projects
None yet
Development

No branches or pull requests

4 participants