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

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

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

sfllaw opened this issue Sep 22, 2021 · 5 comments

Comments

@sfllaw
Copy link

@sfllaw 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 removed this from the Unreleased milestone Sep 22, 2021
@jamalc jamalc added this to the pkgsite/unplanned milestone Sep 22, 2021
@jba
Copy link
Contributor

@jba jba commented Sep 22, 2021

Sounds reasonable.

@jba
Copy link
Contributor

@jba 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

@gopherbot gopherbot commented Sep 22, 2021

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

@sfllaw
Copy link
Author

@sfllaw 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 <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
@sfllaw
Copy link
Author

@sfllaw sfllaw commented Sep 29, 2021

:shipit: 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants