Commit Graph

3109 Commits

Author SHA1 Message Date
Jörg Thalheim
b9465afb85 replace backtick operator with run3 2025-09-07 22:48:41 -04:00
Jörg Thalheim
5b4d0b6f4b hydra-eval-jobset: disable eval cache 2025-09-07 22:48:41 -04:00
Janne Heß
6c8d789541 Fix too much XSS protections
- Fixes build graphs
- Fixes pagination
- Fixes pressure of new queue runner
2025-09-07 22:48:41 -04:00
ulucs
d9fa44d227 Change the default value for allow_import_from_derivation configuration option to false 2025-09-07 22:48:41 -04:00
ulucs
9dab0aed49 Add parentheses to fix operator precedence 2025-09-07 22:48:41 -04:00
Martin Weinelt
d9020e6f1d jobset-eval: reduce compare options to active jobsets
The list of jobsets is very high on hydra.nixos.org and the compare to
dropdown listing goes over multiple full pages in the busy projects.

If we ignore jobsets that we disable this interface becomes more usable
again.
2025-09-07 22:48:41 -04:00
Jörg Thalheim
f2cbf14f7e webhooks: implement authentication for GitHub and Gitea
- Add HMAC-SHA256 signature verification for webhooks
- Support multiple secrets for rotation
- Add security logging for authentication events
- Maintain backward compatibility (auth optional during migration)
- Add comprehensive test coverage

Without authentication, anyone could trigger job evaluations by sending
POST requests to webhook endpoints. This could lead to resource exhaustion
through repeated requests or manipulation of build scheduling. While not
a data breach risk, it allows unauthorized control over CI/CD operations.
2025-09-07 22:48:40 -04:00
Janne Heß
4d2d0f9722 templates: Hopefully escape all template inputs 2025-09-07 22:48:40 -04:00
Janne Heß
4125de8208 templates: Make whitespace in [% %] consistent 2025-09-07 22:48:40 -04:00
Janne Heß
06c6bd1b7b templates: Use HTML.attributes for all links 2025-09-07 22:48:40 -04:00
Janne Heß
bb78a58ea2 build: Properly escape all input values 2025-09-07 22:48:40 -04:00
Janne Heß
0764b1f48c product-list: Escape untrusted values 2025-09-07 22:48:40 -04:00
Janne Heß
5014274c99 hydra-queue-runner: Validate metric type 2025-09-07 22:48:40 -04:00
Janne Heß
8f3fdc14d8 hydra-queue-runner: Validate hydra-metrics unit 2025-09-07 22:48:40 -04:00
Janne Heß
74d923441e hydra-queue-runner: Validate metric name in hydra-metrics 2025-09-07 22:48:40 -04:00
Janne Heß
9396846892 hydra-queue-runner: Validate release name 2025-09-07 22:48:40 -04:00
Janne Heß
252801cea8 hydra-queue-runner: Verify product names in hydra-build-products 2025-09-07 22:48:40 -04:00
Janne Heß
21a75982aa hydra-queue-runner: Fix potential UB
Removing two characters from a string when it starts with " can lead to
a substring call with -1
2025-09-07 22:48:40 -04:00
Janne Heß
3eeba86a87 hydra-queue-runner: Fix crash when < > are in hydra-build-products
This prevents a forever-hanging build (don't know why) when < or > are
in the path of hydra-build-products. This is not to prevent any XSS (see
next commits), just to prevent the DOS (if you can even call it that).
2025-09-07 22:48:40 -04:00
Jörg Thalheim
64e05c24e2 queue-runner: Add missing signal.h include for SIGINT and kill() 2025-09-07 22:48:40 -04:00
Jörg Thalheim
5187992c94 Migrate from deprecated notification_receiver to connection::listen()
libpqxx 7.10.1 deprecates the notification_receiver class.
2025-09-07 22:48:40 -04:00
Jörg Thalheim
aee4e406e9 Fix libpqxx 7.10.1 API compatibility
- Replace deprecated exec_params/exec_params0 calls with exec()
- Wrap all parameterized queries with pqxx::params{}
- Add .no_rows()/.one_row() to exec calls that don't return results
2025-09-07 22:48:40 -04:00
Jörg Thalheim
44b007c167 hydra-eval-jobs: unset NIX_PATH 2025-09-07 22:48:40 -04:00
Janne Heß
6ea6d8fc70 machine-status: Fixup double localhost during development 2025-09-07 22:48:40 -04:00
Janne Heß
bfd2a4c4f9 machine-status: Make new runner status prettier
- Remove bottom margin
- Properly format memory in human format
- Calculate free memory
- Format the load with 2 digits after comma
- Lpad pressure percentages
- Use a macro to render pressure
- Score -> Scheduling Score
- More spacing in the load
- Add IRQ pressure
2025-09-07 22:48:40 -04:00
Janne Heß
ea2024a9bc machine-status: Render new queue runner details 2025-09-07 22:48:40 -04:00
Janne Heß
81d278fe5b Remove useless previous eval message
This message serves no purpose and looks like something went wrong.
There is nothing wrong, there is just no previous evaluation.
2025-09-07 22:48:40 -04:00
Janne Heß
15e742c8c2 Fixup static libraries in development server 2025-09-07 22:48:40 -04:00
Andreas Rammhold
60876ef897 Add Queue Runner Status to the topbar
I've been searching for this waaay too often in the past and I simply do not see a reason not to include it in the topbar by default.
2025-09-07 22:48:40 -04:00
Janne Heß
dc6fd37e02 Show queue runner v2 status
This is guarded behind a setting and will overwrite everything that was
learned from the machines file. Also drops `sshKeys` since that wasn't
used anyway.
2025-09-07 22:48:40 -04:00
Ivor Wanders
16bb3aad9a Add a link to the raw log. 2025-09-07 22:48:40 -04:00
Janne Heß
fdcb6b4a1b Fix local store detection and related issues
- Add localStore into the stash because it's used in templates
- Hide the Channels button for non-local stores because the link 404s
  anyway
- Fix a style issue when having popovers in dark mode
2025-09-07 22:48:40 -04:00
Dionysis Grigoropoulos
c8549d138d fix: Update Nix download url 2025-09-07 22:48:40 -04:00
John Ericson
de10c0e0fb Fix build with Nix 2.29 2025-06-01 01:37:20 -04:00
Pierre Bourdon
0dd4c0cc8e queue runner: attempt at slightly smarter scheduling criteria
Instead of just going for "whatever is the oldest build we know of",
use the following first:

- Is the step more constrained? If so, schedule it first to avoid
  filling up "more desirable" build slots with less constrained builds.

- Does the step have more dependents? If so, schedule it first to try
  and maximize open parallelism and breadth of scheduling options.

(cherry picked from commit b8d03adaf4)
2025-05-14 20:29:25 -04:00
Pierre Bourdon
17f9920cf9 jobset-eval: fix actions not showing up sometimes for new jobs
New jobs have their "new" status take precedence over them being
"failed" or "queued", which means actions that can act on "failed" or
"queued" jobs weren't shown to the user when they could only act on
"new" jobs.

(cherry picked from commit 9a4a5dd624)
2025-05-14 20:29:25 -04:00
Jörg Thalheim
fa1e989b7d re-enable restrict-eval for non-flakes 2025-05-14 20:29:25 -04:00
Martin Weinelt
47158cf360 web: increase colspan for machine row in machine status 2025-05-14 20:29:25 -04:00
Maximilian Bosch
c7972c3687 Fix displaying eval errors in jobset eval view
Quickfix for something that annoyed me once too often.

Specifically, I'm talking about `/eval/1#tabs-errors`.

To not fetch long errors on each request, this is only done on-demand.
I.e., when the tab is opened, an iframe is requested with the errors.
This iframe uses a template for both the jobset view and the jobset-eval
view. It is differentiated by checking if `jobset` or `eval` is defined.

However, the jobset-eval view also has a `jobset` variable in its stash
which means that in both cases the `if` path was used. Since
`jobset.fetcherrormsg` isn't defined in the eval case though, you always
got an empty error.

The band-aid fix is relatively simple: swap if and else: the `eval`
variable is not defined in the stash of the jobset view, so now this is
a useful condition to decide which view we're in.

(cherry picked from commit 70c3d75f73)
2025-05-14 20:29:25 -04:00
Sandro Jäckel
d12d4753ee Fix compilation with a nix which was compiled withou aws sdk 2025-05-14 20:29:16 -04:00
John Ericson
33a935e8ef Queue-runner: Always produce a machines JSON object
Some checks failed
Test / tests (pull_request) Has been cancelled
Even if there are no machines, there should at least be an empty object.
2025-04-09 11:31:47 -04:00
Pierre Bourdon
65618fd590 web: replace 'errormsg' with 'errormsg IS NULL' in most cases
This is implement in an extremely hacky way due to poor DBIx feature
support. Ideally, what we'd need is a way to tell DBIx to ignore the
errormsg column unless explicitly requested, and to automatically add a
computed 'errormsg IS NULL' column in others. Since it does not support
that, this commit instead hacks some support via method overrides while
taking care to not break anything obvious.
2025-04-09 11:31:47 -04:00
Pierre Bourdon
06ba54fca7 queue-runner: release machine reservation while copying outputs
This allows for better builder usage when the queue runner is busy. To
avoid running into uncontrollable imbalances between builder/queue
runner, we only release the machine reservation after the local
throttler has found a slot to start copying the outputs for that build.

As opposed to asserting uniqueness to understand resource utilization,
we just switch to using `std::unique_ptr`.
2025-04-09 11:31:47 -04:00
K900
e15070c6c2 Add metric for builds waiting for download slot
(cherry picked from commit f23ec71227911891807706b6b978836e4d80edde)
2025-04-09 11:31:47 -04:00
Pierre Bourdon
1e3929e75f queue-runner: switch to pseudorandom ordering of builds processing
We don't rely on sequential / monotonic build IDs processing anymore, so
randomizing actually has the advantage of mixing builds for different
systems together, to avoid only one chunk of builds for a single system
getting processed while builders for other systems are starved.
2025-04-09 11:31:47 -04:00
Pierre Bourdon
28da0a705f queue runner: introduce some parallelism for remote paths lookup
Each output for a given step being ingested is looked up in parallel,
which should basically multiply the speed of builds ingestion by the
average number of outputs per derivation.
2025-04-09 11:31:47 -04:00
Pierre Bourdon
2050b2c324 queue-runner: reduce the time between queue monitor restarts
This will induce more DB queries (though these are fairly cheap), but at
the benefit of processing bumps within 1m instead of within 10m.
2025-04-09 11:31:47 -04:00
Pierre Bourdon
21d6d805ba queue-runner: remove id > X from new builds query
Running the query with/without it shows that it makes no difference to
postgres, since there's an index on finished=0 already. This allows a
few simplifications, but also paves the way towards running multiple
parallel monitor threads in the future.
2025-04-09 11:31:47 -04:00
Pierre Bourdon
478bb01f7f queue-runner: add prom metrics to allow detecting internal bottlenecks
By looking at the ratio of running vs. waiting for the dispatcher and
the queue monitor, we should get better visibility into what hydra is
currently bottlenecked on.

There are other side effects we can try to measure to get to the same
result, but having a simple way doesn't cost us much.
2025-04-09 11:31:47 -04:00
Pierre Bourdon
08bf31b71a queue-runner: limit parallelism of CPU intensive operations
My current theory is that running more parallel xz than available CPU
cores is reducing our overall throughput by requiring more scheduling
overhead and more cache thrashing.
2025-04-09 11:31:47 -04:00