Commit graph

2674 commits

Author SHA1 Message Date
Eelco Dolstra 2b4f14963b
Merge pull request #709 from grahamc/generate-from-postgresql
sql: Generate models from postgresql
2020-02-06 20:18:31 +01:00
Graham Christensen c2f932a7e3
sql: Generate models from postgresql
Lowercasing is due to postgresql not having case-sensitive table names.
It always technically workde before, but those table names never
existed literally.

The switch to generating from postgresql is to handle an upcoming
addition of an auto-incrementign ID to the Jobset table. Sqlite doesn't
seem to be able to handle the table having an auto incrementing ID
field which isn't the primary key, but we can't change the primary
key trivially.

Since hydra doesn't support sqlite and hasn't for many year anyway,
it is easier to just generate from pgsql directly.
2020-02-06 12:23:47 -05:00
Eelco Dolstra 9da60e3c66
Merge pull request #708 from basvandijk/remove-logdiff-button
Remove the "log diff" buttons
2020-01-27 14:36:56 +01:00
Bas van Dijk 5fab5e935b Remove the "log diff" buttons
because they're referencing the removed `logdiff` API.

This API was removed in 4d1816b152.

Fixes #409
2020-01-26 21:45:38 +01:00
Eelco Dolstra 5c0c7d52a0
Merge pull request #700 from hamishmack/master
Fixes for macOS
2020-01-07 11:38:34 +01:00
Hamish Mackenzie 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
Graham Christensen d0f1bda0b8
job prometheus endpoint: drop nixname, too variable 2019-12-29 16:37:13 -05:00
Graham Christensen 64cdc3413c
job prometheus endpoint: d'oh 2019-12-28 20:57:27 -05:00
Graham Christensen f8875f2d68
Merge pull request #699 from grahamc/job-prom
job: create a prometheus endpoint
2019-12-28 20:22:24 -05:00
Graham Christensen d5445bfc1d
job: create a prometheus endpoint
Export the most recent stop time and exit status in
a prometheus-friendly format.
2019-12-28 16:41:49 -05:00
Eelco Dolstra 20dd0bbe6a
Merge pull request #691 from knl/fix-missing-notification-stats
hydra-send-stats: Cleanup removed metrics
2019-11-13 11:49:32 +01:00
Nikola Knezevic 06abfd6b2f hydra-send-stats: Cleanup removed metrics
In 2946899504 these metrics got removed
due to refactoring of how notifications work.
2019-11-13 11:42:58 +01:00
Graham Christensen e89ea733d0
Merge pull request #687 from andir/more-roles
Add `cancel-build` & `bump-to-front` roles
2019-11-07 17:52:58 +01:00
Andreas Rammhold 841a47cabe
Add cancel-build role 2019-11-05 22:56:01 +01:00
Andreas Rammhold ce1e10c116
Add bump-to-front role 2019-11-05 19:32:06 +01:00
Eelco Dolstra 45f8a0ef66
Merge pull request #686 from basvandijk/remove-unused-firstOutput
hydra-eval-jobset: $firstOutput is not used so can be removed
2019-11-05 14:09:54 +01:00
Bas van Dijk 840e99f859 hydra-eval-jobset: $firstOutput is not used so can be removed 2019-11-05 13:58:40 +01:00
Eelco Dolstra 037f6488f6
Merge pull request #680 from grahamc/prometheus
export a /prometheus endpoint
2019-09-25 19:46:42 +02:00
Eelco Dolstra 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
Eelco Dolstra 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
Graham Christensen 3a04f28459
hydra: upgrade nixpkgs to 19.09 2019-09-24 16:51:18 -04:00
Graham Christensen 937e165328
export a /prometheus endpoint
Currently only shows per-machine build times
2019-09-24 16:50:52 -04:00
Eelco Dolstra 4223202c99
Merge pull request #432 from LumiGuide/better-buildMachinesFiles-default
Only set buildMachinesFiles when nix.buildMachines is defined
2019-09-24 19:00:32 +02:00
Eelco Dolstra 242b8b7a31
Merge pull request #676 from knl/fix-term-size-any-log-message
Add Term::Size::Any
2019-08-30 14:17:12 +02:00
Nikola Knezevic a9d744d2a3 Add Term::Size::Any
This removes a supper annoying set of messages that polute the logs:

    Aug 30 09:00:30 xxx.compute.internal hydra-server[957]: Trouble trying to detect your terminal size, looking at $ENV{COLUMNS}
    Aug 30 09:00:30 xxx.compute.internal hydra-server[957]: Term::Size::Any is not installed, can't autodetect terminal column width
2019-08-30 11:58:24 +02:00
Graham Christensen 906d2493c5
Merge pull request #673 from nlewo/jobset-error
Add error boolean attribute to jobset API response
2019-08-26 10:23:52 -04:00
Antoine Eiche c8983ca076 Add haserrormsg boolean attribute to jobset API response
This attribute allows to know if an error occurred or not: when an
error occurs, errormsg is not an empty string. Note we can not use the
errormsg attribute because it can be arbitrarily long and is excluded
from the jobset API response.
2019-08-26 16:07:49 +02:00
Rob Vermaas f10b2c2da8 Update Hydra schema, otherwise hydra-notify will not work. 2019-08-19 17:05:11 +02:00
Eelco Dolstra 89ee74f1e3
Merge pull request #672 from gilligan/extend-jobset-api-response
Extend the jobset API response
2019-08-16 19:39:57 +02:00
tobias pflug 919195b04f Extend the jobset API response
This adds the following (pre-existing) attributes to the jobset response:

- nrtotal
- lastcheckedtime
- starttime
- checkinterval
- triggertime
- fetcherrormsg
- errortime
2019-08-16 16:04:04 +02:00
Eelco Dolstra c8a4030c5f
Fix error in GitlabStatus plugin
May 15 09:20:10 chef hydra-queue-runner[27523]: Hydra::Plugin::GitlabStatus=HASH(0x519a7b8)->buildFinished: Can't call method "value" on an undefined value at /nix/store/858hinflxcl2jd12wv1r3a8j11ybsf6w-hydra-0.1.2629.89fa829/libexec/hydra/lib/Hydra/Plugin/GitlabStatus.pm line 57.

(cherry picked from commit 438ddf5289)
2019-08-15 13:55:47 +02:00
Eelco Dolstra f17cd94bac
Merge pull request #668 from NixOS/notifications
Turn hydra-notify into a daemon
2019-08-14 13:05:56 +02:00
Eelco Dolstra 92d8d6baa5
Avoid fetching Projects/Jobsets just to get the name column
In particular, doing a 'select * from Jobsets where ...' must be
avoided, because the 'errormsg' column can be very big.
2019-08-13 18:18:25 +02:00
Eelco Dolstra 16811d3e78
Plugins: Add isEnabled method
Plugins are now disabled at startup time unless there is some relevant
configuration in hydra.conf. This avoids hydra-notify having to do a
lot of redundant work (a lot of plugins did a lot of database queries
*before* deciding they were disabled).

Note: BitBucketStatus users will need to add 'enable_bitbucket_status
= 1' to hydra.conf.
2019-08-13 18:18:25 +02:00
Eelco Dolstra f49a089fc0
hydra-notify: Don't do an unnecessary fetch of Jobsets 2019-08-13 18:18:24 +02:00
Eelco Dolstra e2537f741b
Restart hydra-notify 2019-08-13 18:18:24 +02:00
Eelco Dolstra d08cfa48d7
Add a 'step_started' notification 2019-08-13 18:18:24 +02:00
Eelco Dolstra 72c36373bb
hydra-notify: Fix processing notifications 2019-08-13 18:18:24 +02:00
Eelco Dolstra 7c7cc8c059
Fix duplicate step_finished notification 2019-08-13 18:18:24 +02:00
Eelco Dolstra 976d88d675
Send notifications when evaluations start/finish/fail
* 'eval_started' has the format '<tmpId>\t<project>\t<jobset>'.

* 'eval_failed' has the format '<tmpId>'. (The cause of the error can
  be found in the database.)

* 'eval_added' has the format '<tmpId>:<evalId>'.
2019-08-13 18:18:24 +02:00
Eelco Dolstra 7114d2aceb
Separate payload elements using \t 2019-08-13 18:18:24 +02:00
Eelco Dolstra c7861b85c4
Add hydra-notify service 2019-08-13 18:18:24 +02:00
Eelco Dolstra 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
Eelco Dolstra f13a2cb6dc
Merge pull request #666 from craigem/you_look
Corrected grammar typo
2019-08-09 12:12:32 +02:00
Craige McWhirter bb4f349161
Corrected grammer typo
Replaced you with look
2019-08-09 13:49:21 +10:00
Eelco Dolstra 9ec258dd4d
Merge pull request #665 from basvandijk/influxdb
Added the InfluxDBNotification plugin including a NixOS test
2019-07-26 17:57:08 +02:00
Nikola Knezevic 06bdc8f85c Added the InfluxDBNotification plugin including a NixOS test
This adds a `InfluxDBNotification` plugin which is configured as:

```
<influxdb>
  url = http://127.0.0.1:8086
  db = hydra
</influxdb>
```

which will write a notification for every finished job to the
configured database in InfluxDB looking like:

```
hydra_build_status,cached=false,job=job,jobset=default,project=sample,repo=default,result=success,status=success,system=x86_64-linux build_id="1",build_status=0i,closure_size=584i,duration=0i,main_build_id="1",queued=0i,size=168i 1564156212
```
2019-07-26 17:47:03 +02:00
Eelco Dolstra 5e9439e774
Merge pull request #657 from nlewo/create-pg-trgm-in-module
Create `pg_trgm` extension in the NixOS module
2019-07-25 17:48:45 +02:00
Antoine Eiche 8a0a5ec3a3 Create extension pg_trgm in the NixOS module
The creation of the `pg_trgm` extension needs superuser power. So,
this patch makes the extension creation in the Hydra NixOS module when
a local database is used.

If it is not possible to create this extension (remote database for
instance with nosuperuser), the creation of the `pg_trgm` index is
skipped (this index speedup queries on builds.drvpath) and warnings
are emitted:

    initialising the Hydra database schema...
    WARNING:  Can not create extension pg_trgm: permission denied to create extension "pg_trgm"
    WARNING:  HINT: Temporary provide superuser role to your Hydra Postgresql user and run the script src/sql/upgrade-57.sql
    WARNING:  The pg_trgm index on builds.drvpath has been skipped (slower complex queries on builds.drvpath)

This allows to keep smooth migrations: the migration process doesn't
require a manual step (but this manual step is recommended on big
remote databases).
2019-07-25 16:19:33 +02:00
Antoine Eiche 42784a9053 sql: refactor some sql statements to lowercase 2019-07-25 16:19:33 +02:00