Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Runner.Common/BrokerServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Task ForceRefreshConnection(VssCredentials credentials)

public bool ShouldRetryException(Exception ex)
{
if (ex is AccessDeniedException || ex is RunnerNotFoundException)
if (ex is AccessDeniedException || ex is RunnerNotFoundException || ex is HostedRunnerDeprovisionedException)
{
return false;
}
Expand Down
5 changes: 5 additions & 0 deletions src/Runner.Listener/BrokerMessageListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ public async Task<TaskAgentMessage> GetNextMessageAsync(CancellationToken token)
Trace.Info("Runner OAuth token has been revoked. Unable to pull message.");
throw;
}
catch (HostedRunnerDeprovisionedException)
{
Trace.Info("Hosted runner has been deprovisioned.");
throw;
}
catch (AccessDeniedException e) when (e.ErrorCode == 1)
{
throw;
Expand Down
5 changes: 5 additions & 0 deletions src/Runner.Listener/MessageListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,11 @@ public async Task<TaskAgentMessage> GetNextMessageAsync(CancellationToken token)
_accessTokenRevoked = true;
throw;
}
catch (HostedRunnerDeprovisionedException)
{
Trace.Info("Hosted runner has been deprovisioned.");
throw;
}
catch (AccessDeniedException e) when (e.ErrorCode == 1)
{
throw;
Expand Down
4 changes: 4 additions & 0 deletions src/Runner.Listener/Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,10 @@ ex is TaskOrchestrationJobAlreadyAcquiredException || // HTTP status 409
{
Trace.Info("Runner OAuth token has been revoked. Shutting down.");
}
catch (HostedRunnerDeprovisionedException)
{
Trace.Info("Hosted runner has been deprovisioned. Shutting down.");
}

return Constants.Runner.ReturnCode.Success;
}
Expand Down
1 change: 1 addition & 0 deletions src/Sdk/RSWebApi/Contracts/BrokerErrorKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ public class BrokerErrorKind
{
public const string RunnerNotFound = "RunnerNotFound";
public const string RunnerVersionTooOld = "RunnerVersionTooOld";
public const string HostedRunnerDeprovisioned = "HostedRunnerDeprovisioned";
}
}
2 changes: 2 additions & 0 deletions src/Sdk/WebApi/WebApi/BrokerHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public async Task<TaskAgentMessage> GetRunnerMessageAsync(
{
ErrorCode = 1
};
case BrokerErrorKind.HostedRunnerDeprovisioned:
throw new HostedRunnerDeprovisionedException(brokerError.Message);
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;

namespace GitHub.Services.WebApi
{
[Serializable]
public sealed class HostedRunnerDeprovisionedException : Exception
{
public HostedRunnerDeprovisionedException()
: base()
{
}

public HostedRunnerDeprovisionedException(String message)
: base(message)
{
}

public HostedRunnerDeprovisionedException(String message, Exception innerException)
: base(message, innerException)
{
}
}
}