Commit graph

3120 commits

Author SHA1 Message Date
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 1c9e22e73c
Use nixFlakes in devShell 2019-08-09 13:10:50 +02:00
Eelco Dolstra a74dec6fb1
Merge remote-tracking branch 'origin/master' into flake 2019-08-09 12:46:52 +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
Graham Christensen 8c9aec5f12
Merge pull request #658 from nlewo/fix-test-api
test.api: use Hydra perl dependencies to run `api-test.pl`
2019-07-24 10:56:19 -04:00
Antoine Eiche c620bc2be0 test.api: use Hydra perl dependencies to run api-test.pl
The test was failing with:

    machine# Can't locate LWP/UserAgent.pm in @INC (you may need to install the LWP::UserAgent module)...
2019-06-21 16:57:12 +02:00
Eelco Dolstra c85bf668e6
Merge pull request #656 from nlewo/search-limit-param
hydra-server: add limit parameter on search path
2019-06-19 16:45:51 +02:00
Antoine Eiche d1e590af1f hydra-server: add limit parameter to the search path
This allows a client to set a limit to the search results it wants to
get:

    http://hydra.nixos.org/search?query=emacs&limit=1

This returns only 1 results (while the default is 500).
2019-06-19 14:30:32 +02:00
Antoine Eiche cb1fce21ba hydra-server: set a limit on builds and buildoutputs search
This patch adds a limit statement for Postgresql queries on `builds`
and `buildsoutputs` tables.
2019-06-19 14:28:55 +02:00
Eelco Dolstra d834ac9c14
Update flake.{nix,lock} 2019-06-18 18:00:40 +02:00
Eelco Dolstra 2b4658b6ea
Merge pull request #654 from nlewo/lewo-search-by-hash
Allow to search builds by hash
2019-06-13 14:36:29 +02:00
Antoine Eiche 7935cffd6b Create a pg_trgm index on builds.drvpath
The search query uses the LIKE operator which requires a sequential
scan (it can't use the already existing B-tree index). This new
index (trigram) avoids a sequential scan of the builds table when the
LIKE operator is used.

Here is the analyze of a request on the builds table with this index:

     explain analyze select * from builds where drvpath like '%k3r71gz0gv16ld8rhcp2bb8gb5w1xc4b%';
                                                                 QUERY PLAN
     -----------------------------------------------------------------------------------------------------------------------------------
      Bitmap Heap Scan on builds  (cost=128.00..132.01 rows=1 width=492) (actual time=0.070..0.077 rows=1 loops=1)
        Recheck Cond: (drvpath ~~ '%k3r71gz0gv16ld8rhcp2bb8gb5w1xc4b%'::text)
        ->  Bitmap Index Scan on indextrgmbuildsondrvpath  (cost=0.00..128.00 rows=1 width=0) (actual time=0.047..0.047 rows=3 loops=1)
              Index Cond: (drvpath ~~ '%k3r71gz0gv16ld8rhcp2bb8gb5w1xc4b%'::text)
      Total runtime: 0.206 ms
     (5 rows)
2019-06-06 14:28:25 +02:00
Antoine Eiche 778fc03570 Allow to search builds by hash
Currently, a full store path has to be provided to search in
builds. This patch permits to search jobs with a output path or
derivation hash.

Usecase: we are building Docker images with Hydra. The tag of the
Docker image is the hash of the image output path. This patch would
allow us to find back the build job from the tag of a running
container image.
2019-06-05 11:56:42 +02:00
Eelco Dolstra 7936a29364
hydra-eval-jobs: Use 'checks' output if there is no 'hydraJobs' output 2019-06-03 13:55:32 +02:00
Eelco Dolstra 9a8880fd28
Doh 2019-06-03 13:53:22 +02:00
Eelco Dolstra 517acb4ca8
Add some flake checks 2019-06-03 12:29:42 +02:00
Eelco Dolstra 0042183717
Fix build 2019-06-03 12:23:49 +02:00
Eelco Dolstra bc11ab22a3
Update flake.nix 2019-06-03 12:09:18 +02:00
Graham Christensen 1be7de15a8
Merge pull request #648 from danbst/pg-changes
tests: change postgresql socket dir to /tmp
2019-05-23 15:59:31 -04:00
Eelco Dolstra b7be2bf9ad Fix build against the latest flakes branch 2019-05-22 14:51:55 +02:00
Eelco Dolstra 8717d69a36 Build using the nix flake 2019-05-22 14:44:10 +02:00
Eelco Dolstra 438ddf5289
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.
2019-05-15 10:28:16 +02:00
Eelco Dolstra 89fa82930a
Create projects in enabled state 2019-05-11 00:55:26 +02:00
Eelco Dolstra f68cb7b57e
"Reproduce" action: Support flakes
No more need for a reproduction script! It just says something like

  If you have Nix installed, you can reproduce this build on your own
  machine by running the following command:

  # nix build github:edolstra/dwarffs/09c823e977946668b63ad6c88ed358b48220f124:hydraJobs.build.x86_64-linux
2019-05-11 00:53:00 +02:00
Eelco Dolstra 4ec51032ee
Jobset eval page: Show immutable flake URI 2019-05-11 00:52:06 +02:00
Eelco Dolstra ed00f0b25e
Cache flake-based jobset evaluations 2019-05-11 00:41:13 +02:00
Eelco Dolstra 30e8fe951b
Improve error message 2019-05-11 00:40:40 +02:00
Eelco Dolstra 0387787e7e
TODO 2019-05-11 00:14:18 +02:00
Eelco Dolstra 842ef9af24
hydra-eval-jobset: Support flakes 2019-05-11 00:11:38 +02:00
Eelco Dolstra f9f595cd21
Add flake configuration to the web interface 2019-05-11 00:11:38 +02:00
Eelco Dolstra 6ee6ec3bda
hydra-eval-jobs: Support flakes
E.g. 'hydra-eval-jobs ~/Dev/patchelf' is enough to evaluate patchelf -
no need to set up a $NIX_PATH, pass arguments, etc.
2019-05-11 00:11:38 +02:00
Eelco Dolstra ddcf05ac22
release.nix: Do not rely on currentSystem 2019-05-11 00:11:38 +02:00
Eelco Dolstra 2c60019910
hydra-eval-jobs: Modernize argument parser 2019-05-11 00:11:38 +02:00