NixOS / hydra

Hydra, the Nix-based continuous build system
http://nixos.org/hydra
GNU General Public License v3.0
1.2k stars 304 forks source link

Field `compress_num_threads` declared twice break the cache. #1389

Open amerocu opened 5 months ago

amerocu commented 5 months ago

Describe the bug If the option compress_num_threads is set multiple times in the hydra configurations, hydra is no more able to serve the cache.

From the service logs:

hydra-server[896354]: sh: -c: line 1: syntax error near unexpected token `('
hydra-server[896354]: sh: -c: line 1: `nix-store --dump '/nix/store/hzlywcjdlr0n0nibcrfm9x5hh58nvzqb-src' | pixz -0 -pARRAY(0x4a06e50)'

while running this command from a client:

$ curl https://yourhydra.nix/nar/hzlywcjdlr0n0nibcrfm9x5hh58nvzqb-src --output derivation.bundle

The point of the hydra code that throws that error is this one.

It seems that if a field is declared more times in the configuration, the value of the field in the configuration becomes a list.

This bug happens every time the field compress_num_threads is set, because the hydra repository module always set a value for this field.

To Reproduce Steps to reproduce the behavior:

  1. Deploy the hydra application with compress_num_threads declared twice.

Expected behavior The cache should be served successfully, honoring the last value declared.