Ignore certain scenarios so they are not counted as infra failures (#889)

* Ignore certain scenarios so they are not counted as infra failures

* Check to make sure request is not cancelled
This commit is contained in:
Yang Cao
2021-01-05 16:08:02 -05:00
committed by GitHub
parent 5ba6a2c78d
commit d2cb9d7685
2 changed files with 32 additions and 2 deletions

View File

@@ -594,7 +594,7 @@ namespace GitHub.Runner.Worker
actionDownloadInfos = await jobServer.ResolveActionDownloadInfoAsync(executionContext.Global.Plan.ScopeIdentifier, executionContext.Global.Plan.PlanType, executionContext.Global.Plan.PlanId, new WebApi.ActionReferenceList { Actions = actionReferences }, executionContext.CancellationToken);
break;
}
catch (Exception ex)
catch (Exception ex) when (!executionContext.CancellationToken.IsCancellationRequested) // Do not retry if the run is canceled.
{
if (attempt < 3)
{
@@ -609,7 +609,18 @@ namespace GitHub.Runner.Worker
}
else
{
throw new WebApi.FailedToResolveActionDownloadInfoException("Failed to resolve action download info.", ex);
// Some possible cases are:
// * Repo is rate limited
// * Repo or tag doesn't exist, or isn't public
if (ex is WebApi.UnresolvableActionDownloadInfoException)
{
throw;
}
else
{
// This exception will be traced as an infrastructure failure
throw new WebApi.FailedToResolveActionDownloadInfoException("Failed to resolve action download info.", ex);
}
}
}
}

View File

@@ -2459,6 +2459,25 @@ namespace GitHub.DistributedTask.WebApi
}
}
[Serializable]
public class UnresolvableActionDownloadInfoException : DistributedTaskException
{
public UnresolvableActionDownloadInfoException(String message)
: base(message)
{
}
public UnresolvableActionDownloadInfoException(String message, Exception innerException)
: base(message, innerException)
{
}
protected UnresolvableActionDownloadInfoException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
[Serializable]
public sealed class FailedToResolveActionDownloadInfoException : DistributedTaskException
{