From 13d4c339550f6241387e5afd425d2c0eb24af665 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Wed, 26 Jun 2024 09:44:46 +0200 Subject: [PATCH] feat: better exception on rebuild (#135) --- src/repror/cli/rebuild_recipe.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/repror/cli/rebuild_recipe.py b/src/repror/cli/rebuild_recipe.py index 9784aa4..a2b2b54 100644 --- a/src/repror/cli/rebuild_recipe.py +++ b/src/repror/cli/rebuild_recipe.py @@ -6,6 +6,7 @@ from repror.internals.build import BuildInfo, RebuildResult, Recipe, _rebuild_package from repror.internals.db import ( Build, + BuildState, get_latest_build_with_rebuild, save, ) @@ -69,6 +70,11 @@ def rebuild_recipe( f"No build found for recipe {recipe.name}. Cannot rebuild." ) + if latest_build.state == BuildState.FAIL: + raise ValueError( + f"Build failed for recipe {recipe.name}. Cannot rebuild." + ) + if latest_rebuild and not force: print("Found latest rebuild. Skipping rebuilding it again") continue