mirror of
https://github.com/actions/runner.git
synced 2026-01-08 11:21:13 +08:00
Mark action download failures as infra failures (#2827)
* Mark action download failures as infra failures * Fix Windows variable name * Update src/Runner.Worker/ActionManager.cs Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> --------- Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com>
This commit is contained in:
@@ -115,6 +115,14 @@ namespace GitHub.Runner.Worker
|
||||
executionContext.Result = TaskResult.Failed;
|
||||
throw;
|
||||
}
|
||||
catch (InvalidActionArchiveException ex)
|
||||
{
|
||||
// Log the error and fail the PrepareActionsAsync Initialization.
|
||||
Trace.Error($"Caught exception from PrepareActionsAsync Initialization: {ex}");
|
||||
executionContext.InfrastructureError(ex.Message);
|
||||
executionContext.Result = TaskResult.Failed;
|
||||
throw;
|
||||
}
|
||||
if (!FeatureManager.IsContainerHooksEnabled(executionContext.Global.Variables))
|
||||
{
|
||||
if (state.ImagesToPull.Count > 0)
|
||||
@@ -907,7 +915,14 @@ namespace GitHub.Runner.Worker
|
||||
Directory.CreateDirectory(stagingDirectory);
|
||||
|
||||
#if OS_WINDOWS
|
||||
ZipFile.ExtractToDirectory(archiveFile, stagingDirectory);
|
||||
try
|
||||
{
|
||||
ZipFile.ExtractToDirectory(archiveFile, stagingDirectory);
|
||||
}
|
||||
catch (InvalidDataException e)
|
||||
{
|
||||
throw new InvalidActionArchiveException($"Can't un-zip archive file: {archiveFile}. action being checked out: {downloadInfo.NameWithOwner}@{downloadInfo.Ref}. error: {e}.");
|
||||
}
|
||||
#else
|
||||
string tar = WhichUtil.Which("tar", require: true, trace: Trace);
|
||||
|
||||
@@ -933,7 +948,7 @@ namespace GitHub.Runner.Worker
|
||||
int exitCode = await processInvoker.ExecuteAsync(stagingDirectory, tar, $"-xzf \"{archiveFile}\"", null, executionContext.CancellationToken);
|
||||
if (exitCode != 0)
|
||||
{
|
||||
throw new NotSupportedException($"Can't use 'tar -xzf' extract archive file: {archiveFile}. return code: {exitCode}.");
|
||||
throw new InvalidActionArchiveException($"Can't use 'tar -xzf' extract archive file: {archiveFile}. Action being checked out: {downloadInfo.NameWithOwner}@{downloadInfo.Ref}. return code: {exitCode}.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user