fix(preprod): Understand ghe.com as github_enterprise#3127
Conversation
To determine vcs_provider we use part of the origin of the URL: https://github.com/foo/bar -> github https://gitlab.com/abcdef -> gitlab This adds special handling for github enterprize remotes. Now instead of: https://foo.ghe.com/foo/bar -> ghe we end up with: https://foo.ghe.com/foo/bar -> github_enterprise as the backend expects.
0d1aa26 to
8ccb16a
Compare
|
|
||
| // GitHub Enterprise Server uses *.ghe.com domains | ||
| if trimmed.ends_with(".ghe.com") { | ||
| return "github_enterprise"; |
There was a problem hiding this comment.
Some optional improvements we could do here (both can wait for a separate PR):
-
We could extract
"github_enterprise"to a constant. -
We could define an enum for the supported providers, and include a fallback for unknown providers, like so:
enum VcsProvider { Github, GithubEnterprise Gitlab, Other(String), // or &str }
Then, we would return the enum from this method. We would probably need to add some serialization logic on the enum, as well as a method to convert an arbitrary string to the enum (probably a
From<&str>impl works), so I guess there's some added complexity, but it would be clear what providers we support natively.
There was a problem hiding this comment.
sounds good! will try to send a follow up shortly.
There was a problem hiding this comment.
Cool! And as I said, I think these are just optional improvements, so no rush. It is also fine if we don't do it.
To determine vcs_provider we use part of the origin of the URL:
https://github.com/foo/bar -> github
https://gitlab.com/abcdef -> gitlab
This adds special handling for github enterprize remotes. Now instead
of:
https://foo.ghe.com/foo/bar -> ghe
we end up with:
https://foo.ghe.com/foo/bar -> github_enterprise
as the backend expects.
Resolves EME-821