Skip to content

Commit

Permalink
Handle new non-retryable exception type (#3191)
Browse files Browse the repository at this point in the history
* Handle new non-retryable exception type

* Update ActionManager.cs
  • Loading branch information
thyeggman committed Mar 21, 2024
1 parent bc8b6e0 commit 4b85145
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Runner.Worker/ActionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,12 @@ private async Task BuildActionContainerAsync(IExecutionContext executionContext,
catch (Exception ex) when (!executionContext.CancellationToken.IsCancellationRequested) // Do not retry if the run is cancelled.
{
// UnresolvableActionDownloadInfoException is a 422 client error, don't retry
// NonRetryableActionDownloadInfoException is an non-retryable exception from Actions
// Some possible cases are:
// * Repo is rate limited
// * Repo or tag doesn't exist, or isn't public
// * Policy validation failed
if (attempt < 3 && !(ex is WebApi.UnresolvableActionDownloadInfoException))
if (attempt < 3 && !(ex is WebApi.UnresolvableActionDownloadInfoException) && !(ex is WebApi.NonRetryableActionDownloadInfoException))
{
executionContext.Output($"Failed to resolve action download info. Error: {ex.Message}");
executionContext.Debug(ex.ToString());
Expand Down
19 changes: 19 additions & 0 deletions src/Sdk/DTWebApi/WebApi/Exceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2498,6 +2498,25 @@ protected UnresolvableActionDownloadInfoException(SerializationInfo info, Stream
}
}

[Serializable]
public class NonRetryableActionDownloadInfoException : DistributedTaskException
{
public NonRetryableActionDownloadInfoException(String message)
: base(message)
{
}

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

protected NonRetryableActionDownloadInfoException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}

[Serializable]
public sealed class FailedToResolveActionDownloadInfoException : DistributedTaskException
{
Expand Down

0 comments on commit 4b85145

Please sign in to comment.