Commit Graph

471 Commits

Author SHA1 Message Date
2808227eb7 Fix std::bad_alloc errors for remote builds
In Nix the protocol was slightly altered[1] to also contain more
information about realisations. This however wasn't read from the pipe
that was used to read from the store.

After the `cmdBuildDerivation` command which caused this issue, Hydra
will issue a `cmdQueryPathInfos` that tries to read from the remote
store as well. However, there's still left over to read from the
previous command and thus Nix fails to properly allocate the expected
string.

[1] See rev a2b69660a9b326b95d48bd222993c5225bbd5b5f

Fixes #898
2021-04-15 15:16:52 +02:00
26ffd4a93e Fix build with latest master 2021-04-08 17:11:15 +02:00
87d46ad5d6 hydra-queue-runner: --build-one: correctly handle a cached build
Previously, the build ID would never flow through channels which
exited.

This patch tracks the buildOne state as part of State and exits avoids
waiting forever for new work.

The code around buildOnly is a bit rough, making this a bit weird to
implement but since it is only used for testing the value of improving
it on its own is a bit questionable.
2021-03-16 16:13:38 -04:00
930f05c38e Bump Nix version 2021-03-10 12:53:03 -05:00
68ac64dbd9 Merge pull request #832 from wizeman/fix-hash-mismatch
Fix persistent hash mismatch errors when importing
2021-03-02 16:04:23 -05:00
f602ed0d86 Remove the sendDerivation logic from the builder
The queue runner used to special-case `localhost` as a remote builder:
Rather than using the normal remote-build (using the
`cmdBuildDerivation` command), it was using the (generally less
efficient, except when running against localhost) `cmdBuildPaths`
command because the latter didn't require a privileged Nix user (so made
testing easier − allowing to run hydra in a container in particular).

However:
1. this means that the build loop can follow two discint code paths depending
   on the setup, the irony being that the most commonly used one in production
   (the “non-localhost” case) isn't the one used in the testsuite (because all
   the tests run against a local store);
2. It turns out that the “localhost” version is buggy in relatively obvious
   ways − in particular a failure in a fixed-output derivation or a hash
   mismatch isn't reported properly;
3. If the “run in a container” use-case is indeed that important, it can be
   (partially) restored using a chroot store (which wouldn't behave excactly
   the same way of course, but would be more than good-enough for testing)
2021-02-23 09:50:15 +01:00
a7d8ee98da Fix build 2021-02-22 15:10:24 +01:00
34a856c7ab Update for receiveContents taking string_view
nix change: https://github.com/NixOS/nix/commit/faa31f40
2020-12-26 11:23:26 +00:00
f47749a62d Fix persistent hash mismatch errors when importing
This would start happening if the network connection between the Hydra
server and the remote build server breaks after sucessfully importing
at least one output of a derivation, but before having finished
importing all outputs.

Fixes #816.
2020-11-10 04:50:35 +01:00
73dfef364b Copy deriver field to the binary cache
Fixes https://github.com/NixOS/nixos-org-configurations/issues/129.
2020-11-02 17:08:02 +01:00
4e05acc471 Fix localhost builds 2020-10-20 12:11:46 +02:00
6cd2bb6954 Fix build 2020-10-18 21:01:06 +02:00
9cc76f6d69 Fix build with latest Nix
Recently a few internal APIs have changed[1]. The `outputPaths` function
has been removed and a lot of data structures are modeled with
`std::optional` which broke compilation.

This patch updates the code in `hydra-queue-runner` accordingly to make
sure that Hydra compiles again.

[1] https://github.com/NixOS/nix/pull/3883
2020-09-26 23:37:39 +02:00
405c52b589 Fix build 2020-08-27 17:46:36 +02:00
1113c2895a Fix build 2020-08-07 21:42:09 +02:00
f8e15bc311 Revive putBytes 2020-08-04 18:25:21 +02:00
4b5813051b unsigned long long -> uint64_t 2020-08-04 11:38:22 +02:00
7d3ba616a9 Fix build 2020-08-04 11:33:29 +02:00
77c33c1d71 Restore NoCheckSigs
https://github.com/NixOS/nixpkgs/pull/93945#issuecomment-668244478
2020-08-04 10:53:06 +02:00
8722927c08 Copy paths in the right order 2020-07-28 13:46:57 +02:00
a0e24f446b Remove unused getMemSize() function 2020-07-27 20:40:57 +02:00
5b4df3ad5a Get data needed by getBuildOutput() from the incoming NAR in a streaming fashion 2020-07-27 20:38:59 +02:00
d4e4be4fd1 Remove SHA-1 hash from BuildProducts
SHA-1 is deprecated and it will be expensive to compute with the
streaming NAR handler.
2020-07-27 18:24:10 +02:00
7622cbfe37 buildRemote(): Copy paths to the destination store in O(1) memory 2020-07-27 18:11:04 +02:00
cbcf6359b4 Remove TokenServer in preparation of making NAR copying O(1) memory 2020-07-27 14:57:22 +02:00
e5f6fc2e4e Quick hack to fix compilation 2020-07-27 14:53:43 +02:00
7985757a1d Fix build 2020-07-08 12:50:02 +02:00
bb32aafa4a Fix build 2020-06-23 13:56:44 +02:00
f020f7efef hydra-queue-runner: don't try to distribute builds on localhost 2020-05-03 00:05:52 -04:00
7b705758ec Merge pull request #732 from Ma27/fix-build
Fix build against latest Nix
2020-04-09 09:02:45 -04:00
6e358189ad Separate the build IDs in the build_finished payload with tabs
hydra-notify splits the payload on tabs so we shouldn't separate the
IDs with spaces.
2020-04-08 12:05:25 +02:00
2f9d422172 Fix build against latest Nix 2020-04-07 13:55:38 +02:00
a055796ef5 Merge branch 'master' into libpqxx_undeprecate 2020-04-01 11:54:41 -07:00
6c0bb909df Merge pull request #704 from basvandijk/sleep-after-catch-exception
hydra-queue-runner: sleep 5s after handling an exception
2020-04-01 13:04:31 +02:00
9727892b61 Don't spam the journal with hydra-queue-runner status dumps
(cherry picked from commit 15ae932488)
2020-03-31 22:19:07 +02:00
ccd046ca3d Keep track of the number of unsupported steps
(cherry picked from commit 45ffe578b6)
2020-03-31 22:19:03 +02:00
4417f9f260 Abort unsupported build steps
If we don't see machine that supports a build step for
'max_unsupported_time' seconds, the step is aborted. The default is 0,
which is appropriate for Hydra installations that don't provision
missing machines dynamically.

(cherry picked from commit f5cdbfe21d)
2020-03-31 22:19:01 +02:00
adf61e5cf8 Fix build
(cherry picked from commit 639c660abf)
2020-02-20 10:26:45 +01:00
e4f5156c41 Build against nix-master
(cherry picked from commit e7f2139e25)
2020-02-20 10:24:04 +01:00
b790a00729 Disable deprecation warnings
(cherry picked from commit 950e8bef6c)
2020-02-20 10:22:21 +01:00
08bfff9d13 hydra-queue-runner: sleep 5s after handling an exception
instead of immediately calling `readMachinesFiles` again which could
immediately throw another exception again.
2020-01-14 13:34:35 +01:00
ec8b2970e0 Remove added strictness to allow multiple query returns. 2020-01-12 10:18:52 -08:00
7bb6b5e206 Update libpqxx usage to move away from deprecated API interactions. 2020-01-11 22:38:40 -08:00
c40c887e50 Fixes for macOS
Building on macOS with the latest nixpkgs master and NixOS/nixpkgs#77147
fails.  It seems some `std::experimental` (optional) for instance are
not available as `experimental`, but are in `std`.  Also `toJSON` is
missing for `atomic< unsigned long long >`.
2020-01-07 12:38:06 +13:00
d4b4255dd2 hydra-queue-runner: Support running in a NixOS container
In a NixOS container, cmdBuildDerivation doesn't work because we're
not privileged. But we also don't need it because the store already
has the derivation.

Also, don't copy from/to the store since this gives errors about
missing signatures.
2019-09-25 17:26:03 +02:00
554bb7d9ce hydra-queue-runner: Don't pass IN_SYSTEMD to child processes
This caused local builds to have journal priority prefixes
(e.g. '<3>').
2019-09-25 17:25:07 +02:00
d08cfa48d7 Add a 'step_started' notification 2019-08-13 18:18:24 +02:00
7c7cc8c059 Fix duplicate step_finished notification 2019-08-13 18:18:24 +02:00
7114d2aceb Separate payload elements using \t 2019-08-13 18:18:24 +02:00
2946899504 Turn hydra-notify into a daemon
It now receives notifications about started/finished builds/steps via
PostgreSQL. This gets rid of the (substantial) overhead of starting
hydra-notify for every event. It also allows other programs (even on
other machines) to listen to Hydra notifications.
2019-08-13 18:18:21 +02:00