From b2d7a3a70d6a757c0baca768d2259417031a8969 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Sun, 19 Jan 2025 19:29:48 -0600 Subject: [PATCH] only push if successful build --- pkgs/oizys/src/oizys/nix.nim | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/pkgs/oizys/src/oizys/nix.nim b/pkgs/oizys/src/oizys/nix.nim index dbc38dd..6e0442f 100644 --- a/pkgs/oizys/src/oizys/nix.nim +++ b/pkgs/oizys/src/oizys/nix.nim @@ -389,16 +389,17 @@ proc nixBuildWithCache*(name: string, rest:seq[string], service: string, jobs: i if isCi(): reportResults(results) - # TODO: push after build not at once? - var cmd = service - cmd.addArg "push" - cmd.addArg name - cmd.addArg "--jobs" - cmd.addArg $jobs - cmd.addArgs outs - let pushErr = runCmd(cmd) - if pushErr != 0: - errorQuit "failed to push build to cache" + if outs.len > 0: + # TODO: push after build not at once? + var cmd = service + cmd.addArg "push" + cmd.addArg name + cmd.addArg "--jobs" + cmd.addArg $jobs + cmd.addArgs outs + let pushErr = runCmd(cmd) + if pushErr != 0: + errorQuit "failed to push build to cache" proc getUpdatedLockFile() = info "getting updated flake.lock as updated.lock"