Closed rudymatela closed 2 years ago
Btw, thanks to @ReinierMaas for actually discovering that the build was broken in the first place. ... and to @maartenberg for suggesting cachix push channable $(nix-build ...)
as an alternative fix. :-)
suggesting
cachix push channable $(nix-build ...)
as an alternative fix. :-)
I think cachix push channable $(nix-build ...)
will still attempt to run the outer command (cachix ...
) when the inner command (nix-build ...
) fails.
So if we don't want to rely on the cachix
command itself returning a non-zero exit code, I think this would fix it:
# This will return the exit code of the inner command
$ hoff_store_path=$(nix-build ...)
# Thus, the pipeline will have failed before here if the nix-build was unsuccessful.
$ cachix push channable $hoff_store_path
Semaphore fails to detect this as although nix-build fails, cachix succeeds. The error code of a pipe is (normally) the error code of the last command.
You can also set -o pipefail
to prevent errors from being masked.
Currently (Jun 2022) Hoff, whenever the
nix-build
step fails, the CI does not detect it and we are left with a green build :heavy_check_mark: even though the build was supposed to be red :x:.Here is an example:
Green build:
All steps green:
Nice!
Actual result of the nix-build step:
Ohno! :scream:
Here's the failing command and output section:
Semaphore fails to detect this as although
nix-build
fails,cachix
succeeds. The error code of a pipe is (normally) the error code of the last command. So we should try to break down the commands into two. Something like this:Issue present since 19 April 2022
The CI build was failing all along for two previous versions:
The issue has been here since 19 April 2022 after this merge with hash c4c2e38353046a9526e4ffd5390e6b38b554cbcf PR #105.
The CI build was still okay on v0.24.0