Resolve Actions Directly From Launch for Run Service Jobs (#2529)

Co-authored-by: Tingluo Huang <tingluohuang@github.com>
This commit is contained in:
John Hernley
2023-05-03 16:04:21 -04:00
committed by GitHub
parent 229b9b8ecc
commit 22d1938ac4
9 changed files with 275 additions and 2 deletions

View File

@@ -58,6 +58,18 @@ namespace GitHub.Runner.Worker
await runServer.ConnectAsync(systemConnection.Url, jobServerCredential);
server = runServer;
message.Variables.TryGetValue("system.github.launch_endpoint", out VariableValue launchEndpointVariable);
var launchReceiverEndpoint = launchEndpointVariable?.Value;
if (systemConnection?.Authorization != null &&
systemConnection.Authorization.Parameters.TryGetValue("AccessToken", out var accessToken) &&
!string.IsNullOrEmpty(accessToken) &&
!string.IsNullOrEmpty(launchReceiverEndpoint))
{
Trace.Info("Initializing launch client");
var launchServer = HostContext.GetService<ILaunchServer>();
launchServer.InitializeLaunchClient(new Uri(launchReceiverEndpoint), accessToken);
}
_jobServerQueue = HostContext.GetService<IJobServerQueue>();
_jobServerQueue.Start(message, resultServiceOnly: true);
}