mirror of
https://github.com/actions/runner.git
synced 2025-12-14 22:24:11 +00:00
.
This commit is contained in:
@@ -252,48 +252,48 @@ namespace GitHub.Runner.Common
|
|||||||
|
|
||||||
public Task<List<TaskAgentPool>> GetAgentPoolsAsync(string agentPoolName = null, TaskAgentPoolType poolType = TaskAgentPoolType.Automation)
|
public Task<List<TaskAgentPool>> GetAgentPoolsAsync(string agentPoolName = null, TaskAgentPoolType poolType = TaskAgentPoolType.Automation)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.GetAgentPoolsAsync");
|
||||||
CheckConnection(RunnerConnectionType.Generic);
|
CheckConnection(RunnerConnectionType.Generic);
|
||||||
return _genericTaskAgentClient.GetAgentPoolsAsync(agentPoolName, poolType: poolType);
|
return _genericTaskAgentClient.GetAgentPoolsAsync(agentPoolName, poolType: poolType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<TaskAgent> AddAgentAsync(Int32 agentPoolId, TaskAgent agent)
|
public Task<TaskAgent> AddAgentAsync(Int32 agentPoolId, TaskAgent agent)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.AddAgentAsync");
|
||||||
CheckConnection(RunnerConnectionType.Generic);
|
CheckConnection(RunnerConnectionType.Generic);
|
||||||
return _genericTaskAgentClient.AddAgentAsync(agentPoolId, agent);
|
return _genericTaskAgentClient.AddAgentAsync(agentPoolId, agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<TaskAgent>> GetAgentsAsync(int agentPoolId, string agentName = null)
|
public Task<List<TaskAgent>> GetAgentsAsync(int agentPoolId, string agentName = null)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.GetAgentsAsync 1");
|
||||||
CheckConnection(RunnerConnectionType.Generic);
|
CheckConnection(RunnerConnectionType.Generic);
|
||||||
return _genericTaskAgentClient.GetAgentsAsync(agentPoolId, agentName, false);
|
return _genericTaskAgentClient.GetAgentsAsync(agentPoolId, agentName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<TaskAgent>> GetAgentsAsync(string agentName)
|
public Task<List<TaskAgent>> GetAgentsAsync(string agentName)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.GetAgentsAsync 2");
|
||||||
return GetAgentsAsync(0, agentName); // search in all all agentPools
|
return GetAgentsAsync(0, agentName); // search in all all agentPools
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<TaskAgent> ReplaceAgentAsync(int agentPoolId, TaskAgent agent)
|
public Task<TaskAgent> ReplaceAgentAsync(int agentPoolId, TaskAgent agent)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.ReplaceAgentAsync");
|
||||||
CheckConnection(RunnerConnectionType.Generic);
|
CheckConnection(RunnerConnectionType.Generic);
|
||||||
return _genericTaskAgentClient.ReplaceAgentAsync(agentPoolId, agent);
|
return _genericTaskAgentClient.ReplaceAgentAsync(agentPoolId, agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task DeleteAgentAsync(int agentPoolId, int agentId)
|
public Task DeleteAgentAsync(int agentPoolId, int agentId)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.DeleteAgentAsync");
|
||||||
CheckConnection(RunnerConnectionType.Generic);
|
CheckConnection(RunnerConnectionType.Generic);
|
||||||
return _genericTaskAgentClient.DeleteAgentAsync(agentPoolId, agentId);
|
return _genericTaskAgentClient.DeleteAgentAsync(agentPoolId, agentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task DeleteAgentAsync(int agentId)
|
public Task DeleteAgentAsync(int agentId)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.DeleteAgentAsync");
|
||||||
return DeleteAgentAsync(0, agentId); // agentPool is ignored server side
|
return DeleteAgentAsync(0, agentId); // agentPool is ignored server side
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,21 +310,21 @@ namespace GitHub.Runner.Common
|
|||||||
|
|
||||||
public Task DeleteAgentMessageAsync(Int32 poolId, Int64 messageId, Guid sessionId, CancellationToken cancellationToken)
|
public Task DeleteAgentMessageAsync(Int32 poolId, Int64 messageId, Guid sessionId, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.DeleteAgentMessageAsync");
|
||||||
CheckConnection(RunnerConnectionType.MessageQueue);
|
CheckConnection(RunnerConnectionType.MessageQueue);
|
||||||
return _messageTaskAgentClient.DeleteMessageAsync(poolId, messageId, sessionId, cancellationToken: cancellationToken);
|
return _messageTaskAgentClient.DeleteMessageAsync(poolId, messageId, sessionId, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task DeleteAgentSessionAsync(Int32 poolId, Guid sessionId, CancellationToken cancellationToken)
|
public Task DeleteAgentSessionAsync(Int32 poolId, Guid sessionId, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.DeleteAgentSessionAsync");
|
||||||
CheckConnection(RunnerConnectionType.MessageQueue);
|
CheckConnection(RunnerConnectionType.MessageQueue);
|
||||||
return _messageTaskAgentClient.DeleteAgentSessionAsync(poolId, sessionId, cancellationToken: cancellationToken);
|
return _messageTaskAgentClient.DeleteAgentSessionAsync(poolId, sessionId, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<TaskAgentMessage> GetAgentMessageAsync(Int32 poolId, Guid sessionId, Int64? lastMessageId, CancellationToken cancellationToken)
|
public Task<TaskAgentMessage> GetAgentMessageAsync(Int32 poolId, Guid sessionId, Int64? lastMessageId, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.GetAgentMessageAsync");
|
||||||
CheckConnection(RunnerConnectionType.MessageQueue);
|
CheckConnection(RunnerConnectionType.MessageQueue);
|
||||||
return _messageTaskAgentClient.GetMessageAsync(poolId, sessionId, lastMessageId, cancellationToken: cancellationToken);
|
return _messageTaskAgentClient.GetMessageAsync(poolId, sessionId, lastMessageId, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
@@ -335,21 +335,21 @@ namespace GitHub.Runner.Common
|
|||||||
|
|
||||||
public Task<TaskAgentJobRequest> RenewAgentRequestAsync(int poolId, long requestId, Guid lockToken, string orchestrationId = null, CancellationToken cancellationToken = default(CancellationToken))
|
public Task<TaskAgentJobRequest> RenewAgentRequestAsync(int poolId, long requestId, Guid lockToken, string orchestrationId = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.RenewAgentRequestAsync");
|
||||||
CheckConnection(RunnerConnectionType.JobRequest);
|
CheckConnection(RunnerConnectionType.JobRequest);
|
||||||
return _requestTaskAgentClient.RenewAgentRequestAsync(poolId, requestId, lockToken, orchestrationId: orchestrationId, cancellationToken: cancellationToken);
|
return _requestTaskAgentClient.RenewAgentRequestAsync(poolId, requestId, lockToken, orchestrationId: orchestrationId, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<TaskAgentJobRequest> FinishAgentRequestAsync(int poolId, long requestId, Guid lockToken, DateTime finishTime, TaskResult result, CancellationToken cancellationToken = default(CancellationToken))
|
public Task<TaskAgentJobRequest> FinishAgentRequestAsync(int poolId, long requestId, Guid lockToken, DateTime finishTime, TaskResult result, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.FinishAgentRequestAsync");
|
||||||
CheckConnection(RunnerConnectionType.JobRequest);
|
CheckConnection(RunnerConnectionType.JobRequest);
|
||||||
return _requestTaskAgentClient.FinishAgentRequestAsync(poolId, requestId, lockToken, finishTime, result, cancellationToken: cancellationToken);
|
return _requestTaskAgentClient.FinishAgentRequestAsync(poolId, requestId, lockToken, finishTime, result, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<TaskAgentJobRequest> GetAgentRequestAsync(int poolId, long requestId, CancellationToken cancellationToken = default(CancellationToken))
|
public Task<TaskAgentJobRequest> GetAgentRequestAsync(int poolId, long requestId, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.GetAgentRequestAsync");
|
||||||
CheckConnection(RunnerConnectionType.JobRequest);
|
CheckConnection(RunnerConnectionType.JobRequest);
|
||||||
return _requestTaskAgentClient.GetAgentRequestAsync(poolId, requestId, cancellationToken: cancellationToken);
|
return _requestTaskAgentClient.GetAgentRequestAsync(poolId, requestId, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
@@ -359,21 +359,21 @@ namespace GitHub.Runner.Common
|
|||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
public Task<List<PackageMetadata>> GetPackagesAsync(string packageType, string platform, int top, bool includeToken, CancellationToken cancellationToken)
|
public Task<List<PackageMetadata>> GetPackagesAsync(string packageType, string platform, int top, bool includeToken, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.GetPackagesAsync");
|
||||||
CheckConnection(RunnerConnectionType.Generic);
|
CheckConnection(RunnerConnectionType.Generic);
|
||||||
return _genericTaskAgentClient.GetPackagesAsync(packageType, platform, top, includeToken, cancellationToken: cancellationToken);
|
return _genericTaskAgentClient.GetPackagesAsync(packageType, platform, top, includeToken, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<PackageMetadata> GetPackageAsync(string packageType, string platform, string version, bool includeToken, CancellationToken cancellationToken)
|
public Task<PackageMetadata> GetPackageAsync(string packageType, string platform, string version, bool includeToken, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.GetPackageAsync");
|
||||||
CheckConnection(RunnerConnectionType.Generic);
|
CheckConnection(RunnerConnectionType.Generic);
|
||||||
return _genericTaskAgentClient.GetPackageAsync(packageType, platform, version, includeToken, cancellationToken: cancellationToken);
|
return _genericTaskAgentClient.GetPackageAsync(packageType, platform, version, includeToken, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<TaskAgent> UpdateAgentUpdateStateAsync(int agentPoolId, int agentId, string currentState, string trace)
|
public Task<TaskAgent> UpdateAgentUpdateStateAsync(int agentPoolId, int agentId, string currentState, string trace)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("RunnerServer.qqq");
|
System.Console.WriteLine("RunnerServer.UpdateAgentUpdateStateAsync");
|
||||||
CheckConnection(RunnerConnectionType.Generic);
|
CheckConnection(RunnerConnectionType.Generic);
|
||||||
return _genericTaskAgentClient.UpdateAgentUpdateStateAsync(agentPoolId, agentId, currentState, trace);
|
return _genericTaskAgentClient.UpdateAgentUpdateStateAsync(agentPoolId, agentId, currentState, trace);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ namespace GitHub.Services.Common
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("VssHttpMessageHandler.SendAsync: Auth challenge");
|
System.Console.WriteLine($"VssHttpMessageHandler.SendAsync: Auth challenge. Response status code {response.StatusCode}; headers {response.Headers}");
|
||||||
// In the case of a Windows token, only apply it to the web proxy if it
|
// In the case of a Windows token, only apply it to the web proxy if it
|
||||||
// returned a 407 Proxy Authentication Required. If we didn't get this
|
// returned a 407 Proxy Authentication Required. If we didn't get this
|
||||||
// status code back, then the proxy (if there is one) is clearly working fine,
|
// status code back, then the proxy (if there is one) is clearly working fine,
|
||||||
@@ -491,8 +491,8 @@ namespace GitHub.Services.Common
|
|||||||
HttpClientHandler httpClientHandler = handler as HttpClientHandler;
|
HttpClientHandler httpClientHandler = handler as HttpClientHandler;
|
||||||
if (httpClientHandler != null)
|
if (httpClientHandler != null)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine($"VssHttpMessageHandler.ApplySettings: Default credentials = {defaultCredentials}");
|
System.Console.WriteLine($"VssHttpMessageHandler.ApplySettings: Default credentials = {defaultCredentials} AllowAutoRedirect = {settings.AllowAutoRedirect}");
|
||||||
httpClientHandler.AllowAutoRedirect = settings.AllowAutoRedirect;
|
httpClientHandler.AllowAutoRedirect = true; //settings.AllowAutoRedirect;
|
||||||
httpClientHandler.ClientCertificateOptions = ClientCertificateOption.Manual;
|
httpClientHandler.ClientCertificateOptions = ClientCertificateOption.Manual;
|
||||||
//Setting httpClientHandler.UseDefaultCredentials to false in .Net Core, clears httpClientHandler.Credentials if
|
//Setting httpClientHandler.UseDefaultCredentials to false in .Net Core, clears httpClientHandler.Credentials if
|
||||||
//credentials is already set to defaultcredentials. Therefore httpClientHandler.Credentials must be
|
//credentials is already set to defaultcredentials. Therefore httpClientHandler.Credentials must be
|
||||||
|
|||||||
@@ -881,6 +881,7 @@ namespace GitHub.Services.WebApi
|
|||||||
[Obsolete("Use VssHttpClientBase.HandleResponseAsync instead")]
|
[Obsolete("Use VssHttpClientBase.HandleResponseAsync instead")]
|
||||||
protected virtual void HandleResponse(HttpResponseMessage response)
|
protected virtual void HandleResponse(HttpResponseMessage response)
|
||||||
{
|
{
|
||||||
|
System.Console.WriteLine("VssHttpClientBase.HandleResponse 1");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -888,6 +889,7 @@ namespace GitHub.Services.WebApi
|
|||||||
HttpResponseMessage response,
|
HttpResponseMessage response,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
System.Console.WriteLine($"VssHttpClientBase.HandleResponse 2 status code {response.StatusCode} headers {response.Headers}");
|
||||||
response.Trace();
|
response.Trace();
|
||||||
VssHttpEventSource.Log.HttpRequestStop(VssTraceActivity.Current, response);
|
VssHttpEventSource.Log.HttpRequestStop(VssTraceActivity.Current, response);
|
||||||
|
|
||||||
@@ -899,6 +901,7 @@ namespace GitHub.Services.WebApi
|
|||||||
}
|
}
|
||||||
else if (ShouldThrowError(response))
|
else if (ShouldThrowError(response))
|
||||||
{
|
{
|
||||||
|
System.Console.WriteLine("VssHttpClientBase.HandleResponse: Should throw error");
|
||||||
Exception exToThrow = null;
|
Exception exToThrow = null;
|
||||||
if (IsJsonResponse(response))
|
if (IsJsonResponse(response))
|
||||||
{
|
{
|
||||||
@@ -922,6 +925,7 @@ namespace GitHub.Services.WebApi
|
|||||||
{
|
{
|
||||||
message = response.ReasonPhrase;
|
message = response.ReasonPhrase;
|
||||||
}
|
}
|
||||||
|
System.Console.WriteLine($"VssHttpClientBase.HandleResponse: Exception message {message}");
|
||||||
exToThrow = new VssServiceResponseException(response.StatusCode, message, exToThrow);
|
exToThrow = new VssServiceResponseException(response.StatusCode, message, exToThrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user