From 22e175727d84a55898f761edd80640a3b7679ef9 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sun, 16 May 2021 08:12:33 -0400 Subject: [PATCH] builders: report hash errors as failures --- ofborg/src/message/buildresult.rs | 3 +++ ofborg/src/nix.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/ofborg/src/message/buildresult.rs b/ofborg/src/message/buildresult.rs index a292ede..59498b6 100644 --- a/ofborg/src/message/buildresult.rs +++ b/ofborg/src/message/buildresult.rs @@ -8,6 +8,7 @@ pub enum BuildStatus { Success, Failure, TimedOut, + HashMismatch, UnexpectedError { err: String }, } @@ -17,6 +18,7 @@ impl From for String { BuildStatus::Skipped => "No attempt".into(), BuildStatus::Success => "Success".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::UnexpectedError { ref err } => format!("Unexpected error: {}", err), } @@ -29,6 +31,7 @@ impl From for Conclusion { BuildStatus::Skipped => Conclusion::Neutral, BuildStatus::Success => Conclusion::Success, BuildStatus::Failure => Conclusion::Neutral, + BuildStatus::HashMismatch => Conclusion::Failure, BuildStatus::TimedOut => Conclusion::Neutral, BuildStatus::UnexpectedError { .. } => Conclusion::Neutral, } diff --git a/ofborg/src/nix.rs b/ofborg/src/nix.rs index 1180e37..ee1760f 100644 --- a/ofborg/src/nix.rs +++ b/ofborg/src/nix.rs @@ -365,6 +365,7 @@ pub fn wait_for_build_status(spawned: SpawnedAsyncCmd) -> BuildStatus { Some(0) => BuildStatus::Success, Some(100) => BuildStatus::Failure, // nix permanent failure Some(101) => BuildStatus::TimedOut, // nix build timedout + Some(102) => BuildStatus::HashMismatch, // Fixed Output Derivation's hash was wrong Some(i) => BuildStatus::UnexpectedError { err: format!("command failed with exit code {}", i), },