hydra icon indicating copy to clipboard operation
hydra copied to clipboard

Hash-mismatch in fixed-output derivations aren’t properly reported

Open thufschmitt opened this issue 4 years ago • 2 comments

When hydra is asked to build a fixed-output derivation that has a wrong hash, it will report it as failed, but without indicating that the failure is related to a hash mismatch (the logs won’t show it, and the step will just report that it’s failed).

What I’d like to see

Some clear indication that the failure is due to a hash mismatch, either in the build logs or in the build page

A bit more context

The issue is that:

  1. This doesn’t appear in the logs because these only contain the actual output of the builder (and the hash mismatch error is an exception thrown by the nix-store process
  2. The exception message should be propagated by hydra, but for some reason it is set to an empty string. @edolstra do you remember why it was this way and whether this still makes sense?

thufschmitt avatar Apr 29 '21 19:04 thufschmitt

Is there any progress on this? This is still an issue and a rather annoying one if you are relying on Hydra for a CI solution.

For instance I set hashes to lib.fakeHash in code when updating sources, and I wanted the CI to report the correct hashes to me as a regular build would, however Hydra does only show the log, not the error as far as I can tell.

So when I update the hash the UI reports exactly what nix log would:

% nix log /nix/store/3bi5dk14g0bj2z1rqny0f4n0lkazhvc2-source.drv

trying https://github.com/benaryorg/lxddns/archive/554d5a9fcd28a4d9161950ffa58cdae4a731f4c4.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
^M100 12970    0 12970    0     0  28818      0 --:--:-- --:--:-- --:--:-- 28818^M100 33327    0 33327    0     0  73210      0 --:--:-- --:--:-- --:--:-- 3975k
unpacking source archive /build/554d5a9fcd28a4d9161950ffa58cdae4a731f4c4.tar.gz

The above is reported on the UI with a failed state. As you can see in the output there is nothing to indicate the error or anything of sorts. When I run the build manually it shows the appropriate error:

% nix build /nix/store/3bi5dk14g0bj2z1rqny0f4n0lkazhvc2-source.drv
error: hash mismatch in fixed-output derivation '/nix/store/3bi5dk14g0bj2z1rqny0f4n0lkazhvc2-source.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            got:    sha256-phIPejlAIoo3yRIuHwX72trgaIniEHhMWZtxx8fBV4g=

Having this error reflected in the Hydra UI would be much appreciated.

benaryorg avatar Jul 07 '23 17:07 benaryorg

Note that the same applies to all failures that cause error messages via the nix system it seems. Hash failures from within other pieces of code (such as the rust build system) do not propagate either, and you're just left with the log which contains none of the information required to pinpoint and fix the issue.

benaryorg avatar Jul 07 '23 17:07 benaryorg