From 68ca45791718d3877d0ccda6b95ad5bf3e984467 Mon Sep 17 00:00:00 2001 From: Tingluo Huang Date: Wed, 19 Mar 2025 09:12:17 -0400 Subject: [PATCH] Allow server enforce runner settings. (#3758) --- .../Configuration/ConfigurationManager.cs | 14 ++++++++++++++ src/Sdk/Sdk.csproj | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Runner.Listener/Configuration/ConfigurationManager.cs b/src/Runner.Listener/Configuration/ConfigurationManager.cs index 05b93cb58..e83eab1e1 100644 --- a/src/Runner.Listener/Configuration/ConfigurationManager.cs +++ b/src/Runner.Listener/Configuration/ConfigurationManager.cs @@ -404,6 +404,20 @@ namespace GitHub.Runner.Listener.Configuration } } + // allow the server to override the serverUrlV2 and useV2Flow + if (agent.Properties.TryGetValue("ServerUrlV2", out string serverUrlV2) && + !string.IsNullOrEmpty(serverUrlV2)) + { + Trace.Info($"Service enforced serverUrlV2: {serverUrlV2}"); + runnerSettings.ServerUrlV2 = serverUrlV2; + } + + if (agent.Properties.TryGetValue("UseV2Flow", out bool useV2Flow) && useV2Flow) + { + Trace.Info($"Service enforced useV2Flow: {useV2Flow}"); + runnerSettings.UseV2Flow = useV2Flow; + } + _term.WriteSection("Runner settings"); // We will Combine() what's stored with root. Defaults to string a relative path diff --git a/src/Sdk/Sdk.csproj b/src/Sdk/Sdk.csproj index 5f2c3fd55..41f63ce3e 100644 --- a/src/Sdk/Sdk.csproj +++ b/src/Sdk/Sdk.csproj @@ -18,7 +18,6 @@ -