-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Try to infer runner is on hosted/ghes when githuburl is empty. #4254
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,41 @@ public bool IsHostedServer | |
| { | ||
| return UrlUtil.IsHostedServer(new UriBuilder(GitHubUrl)); | ||
| } | ||
| else | ||
| { | ||
| // feature flag env in case the new logic is wrong. | ||
| if (StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_FORCE_EMPTY_GITHUB_URL_IS_HOSTED"))) | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| // GitHubUrl will be empty for jit configured runner | ||
| // We will try to infer it from the ServerUrl/ServerUrlV2 | ||
| if (StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_FORCE_GHES"))) | ||
| { | ||
| // Allow env to override and force GHES in case the inference logic is wrong. | ||
| return false; | ||
| } | ||
|
|
||
| if (!string.IsNullOrEmpty(ServerUrl)) | ||
| { | ||
| // pipelines services | ||
| var serverUrl = new UriBuilder(ServerUrl); | ||
| return serverUrl.Host.EndsWith(".actions.githubusercontent.com", StringComparison.OrdinalIgnoreCase) | ||
| || serverUrl.Host.EndsWith(".codedev.ms", StringComparison.OrdinalIgnoreCase); | ||
|
TingluoHuang marked this conversation as resolved.
|
||
| } | ||
|
|
||
| if (!string.IsNullOrEmpty(ServerUrlV2)) | ||
| { | ||
| // broker-listener | ||
| var serverUrlV2 = new UriBuilder(ServerUrlV2); | ||
| return serverUrlV2.Host.EndsWith(".actions.githubusercontent.com", StringComparison.OrdinalIgnoreCase) | ||
|
Comment on lines
+78
to
+106
|
||
| || serverUrlV2.Host.EndsWith(".githubapp.com", StringComparison.OrdinalIgnoreCase) | ||
| || serverUrlV2.Host.EndsWith(".ghe.com", StringComparison.OrdinalIgnoreCase) | ||
| || serverUrlV2.Host.EndsWith(".actions.localhost", StringComparison.OrdinalIgnoreCase) | ||
| || serverUrlV2.Host.EndsWith(".ghe.localhost", StringComparison.OrdinalIgnoreCase); | ||
| } | ||
| } | ||
|
|
||
| // Default to true since Hosted runners likely don't have this property set. | ||
| return true; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.