Skip to content

Commit

Permalink
Make Settings.IsHostedServer value consistent with UrlUtil.IsHostedSe…
Browse files Browse the repository at this point in the history
…rver

When running GitHub Enterprise Server with a pool of JIT-configured runners (such as what [philips-labs/terraform-aws-github-runner](https://github.com/philips-labs/terraform-aws-github-runner/) provides), #1199 still occurs. The fix in #1291 uses the "IsHostedServer" property from the settings which is **not** set by the GHES endpoint for JIT configuration.

This change computes the default value of IsHostedServer from the GitHub server URL, as is already done in [lots of other parts of the code](https://github.com/search?q=repo%3Aactions%2Frunner%20IsHostedServer&type=code) to make it consistent.
  • Loading branch information
alixinne committed Jun 10, 2024
1 parent edfdbb9 commit a97d6ac
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Runner.Common/ConfigurationStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ public bool IsHostedServer
get
{
// Old runners do not have this property. Hosted runners likely don't have this property either.
return _isHostedServer ?? true;
if (_isHostedServer != null) {
return (bool)_isHostedServer;
}

// GHES JIT config API does not set this property either, so we need to auto-detect it.
if (GitHubUrl != null) {
return UrlUtil.IsHostedServer(new UriBuilder(GitHubUrl));
}

return true;
}

set
Expand Down

0 comments on commit a97d6ac

Please sign in to comment.