builders: report hash errors as failures

This commit is contained in:
Graham Christensen 2021-05-16 08:12:33 -04:00
parent 231953bf2e
commit 22e175727d
2 changed files with 4 additions and 0 deletions

View file

@ -8,6 +8,7 @@ pub enum BuildStatus {
Success, Success,
Failure, Failure,
TimedOut, TimedOut,
HashMismatch,
UnexpectedError { err: String }, UnexpectedError { err: String },
} }
@ -17,6 +18,7 @@ impl From<BuildStatus> for String {
BuildStatus::Skipped => "No attempt".into(), BuildStatus::Skipped => "No attempt".into(),
BuildStatus::Success => "Success".into(), BuildStatus::Success => "Success".into(),
BuildStatus::Failure => "Failure".into(), BuildStatus::Failure => "Failure".into(),
BuildStatus::HashMismatch => "A fixed output derivation's hash was incorrect".into(),
BuildStatus::TimedOut => "Timed out, unknown build status".into(), BuildStatus::TimedOut => "Timed out, unknown build status".into(),
BuildStatus::UnexpectedError { ref err } => format!("Unexpected error: {}", err), BuildStatus::UnexpectedError { ref err } => format!("Unexpected error: {}", err),
} }
@ -29,6 +31,7 @@ impl From<BuildStatus> for Conclusion {
BuildStatus::Skipped => Conclusion::Neutral, BuildStatus::Skipped => Conclusion::Neutral,
BuildStatus::Success => Conclusion::Success, BuildStatus::Success => Conclusion::Success,
BuildStatus::Failure => Conclusion::Neutral, BuildStatus::Failure => Conclusion::Neutral,
BuildStatus::HashMismatch => Conclusion::Failure,
BuildStatus::TimedOut => Conclusion::Neutral, BuildStatus::TimedOut => Conclusion::Neutral,
BuildStatus::UnexpectedError { .. } => Conclusion::Neutral, BuildStatus::UnexpectedError { .. } => Conclusion::Neutral,
} }

View file

@ -365,6 +365,7 @@ pub fn wait_for_build_status(spawned: SpawnedAsyncCmd) -> BuildStatus {
Some(0) => BuildStatus::Success, Some(0) => BuildStatus::Success,
Some(100) => BuildStatus::Failure, // nix permanent failure Some(100) => BuildStatus::Failure, // nix permanent failure
Some(101) => BuildStatus::TimedOut, // nix build timedout Some(101) => BuildStatus::TimedOut, // nix build timedout
Some(102) => BuildStatus::HashMismatch, // Fixed Output Derivation's hash was wrong
Some(i) => BuildStatus::UnexpectedError { Some(i) => BuildStatus::UnexpectedError {
err: format!("command failed with exit code {}", i), err: format!("command failed with exit code {}", i),
}, },