From a0784bf0279363edfc8aa4ac2115d31cd9b2dfe3 Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Wed, 11 Sep 2024 20:01:13 +0000 Subject: [PATCH] fix: Correct output path with failed builds Previously, if a build failed to produce any output we would try to write "None" to the output file. This doesn't work, causing the job to error. Instead, we should skip writing the output and preserve the original "failed" status. --- buildbot_nix/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/buildbot_nix/__init__.py b/buildbot_nix/__init__.py index d048ec9..e1c9485 100644 --- a/buildbot_nix/__init__.py +++ b/buildbot_nix/__init__.py @@ -339,6 +339,11 @@ class UpdateBuildOutput(steps.BuildStep): if not pr and props.getProperty("branch") != self.project.default_branch: return util.SKIPPED + out_path = props.getProperty("out_path") + + if not out_path: # if, e.g., the build fails and doesn't produce an output + return util.SKIPPED + owner = Path(props.getProperty("owner")) repo = Path(props.getProperty("repository_name")) @@ -355,7 +360,6 @@ class UpdateBuildOutput(steps.BuildStep): file.parent.mkdir(parents=True, exist_ok=True) - out_path = props.getProperty("out_path") file.write_text(out_path) return util.SUCCESS