Commit graph

2941 commits

Author SHA1 Message Date
Nikola Knezevic e9922c460e Add missing SQL upgrade script for NOT NULL on type
`type` column in `Jobsets` is defined as NOT NULL. However, the original upgrade
script adding this column ommited the constraint.
2020-05-18 10:59:55 +02:00
Nikola Knezevic 575113396d Handle missing values in declarative jobsets
The current implementation will pass all values to `create_or_update` method. The
missing values will end up as `undef` (or `NULL`) when assigned to `%update`.
Thus, for columns that are NOT NULL, when, for example, flakes are not used,
will result in a horrible:

    DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st execute failed:
    ERROR:  null value in column "type" violates not-null constraint

    DETAIL:  Failing row contains (.jobsets, 118, hydra, hydra jobsets, src, hydra/jobsets.nix, null,
    null, null, 1589536378, 1, 0, 0, , 3, 30, 100, null, null, 1589536379, null, null). [for Statement
    "UPDATE jobsets SET checkinterval = ?, description = ?, enableemail = ?, nixexprinput = ?,
    nixexprpath = ?, type = ? WHERE ( ( name = ? AND project = ? ) )" with ParamValues: 1='30',
    2='hydra jobsets', 3='0', 4='src', 5='hydra/jobsets.nix', 6=undef, 7='.jobsets', 8='hydra'] at
    /nix/store/lsf81ip9ybxihk5praf2n0nh14a6i9j0-hydra-0.1.19700101.DIRTY/libexec/hydra/lib/Hydra/Helper/AddBuilds.pm line 50

This change just omits adding such values to `%update`, which results in
PostgreSQL assigning the default values.
2020-05-15 20:33:54 +02:00
Eelco Dolstra c4104fe1fa
Merge pull request #759 from gilligan/devshell
Devshell
2020-05-15 14:21:40 +02:00
Tobias Pflug 006233d7f3 README.md update
- drop any mention of runHydra
- link foreman and mention Procfile
2020-05-15 13:59:36 +02:00
Tobias Pflug 31262f14fb Address PR comments:
- scripts -> foreman
- drop runHydra
- drop devShell
- move postgresql to buildInputs
2020-05-15 13:48:21 +02:00
Tobias Pflug fc0eb02ffe Run hydra-dev-server
Execute hydra-dev-server instead of hydra-server

Co-authored-by: Graham Christensen <graham@grahamc.com>
2020-05-15 12:37:16 +02:00
Tobias Pflug 1bcb8d0be9 Use pg_isready for readiness check
Co-authored-by: Graham Christensen <graham@grahamc.com>
2020-05-15 12:37:16 +02:00
Tobias Pflug d9d58b7055 Use pg_ctl for readiness check
Using `pg_ctl status` is more reliable than relying checking an
open port via netcat.
2020-05-15 12:37:16 +02:00
Tobias Pflug 45ac8e0cbc README.md: info about runHydra/foreman
Add sections about using `runHydra` and `foreman`
2020-05-15 12:37:16 +02:00
Tobias Pflug 0add1cc6d8 Default to devShell in shell.nix 2020-05-15 12:37:16 +02:00
Tobias Pflug 07a4465260 Use custom ports for postgres/hydra
Use custom ports so hydra and postgres can run in environments where
the default ports are in use already.
2020-05-15 12:37:16 +02:00
Andreas Rammhold eb06a435ab Add devShell for faster feedback
This adds a `devShell` which unlike `runHydra` doesn't start hydra
automatically and doesn't receive hydra as build input. It is better
suited for interactive development cycles:

```
$ nix-shell -A devShell
$ ./bootstrap
$ configurePhase
$ make
$ # hack hack hack
$ foreman start
  # test test test
  <C-c>
$ # hack hack hack
```
2020-05-15 12:37:16 +02:00
Andreas Rammhold d1237c315d Add runHydra shell
runHyda automatically starts hydra and postgres:

```
$ nix-shell -A runHydra
```

The shell receives hydra from the working copy as buildInput.
Running hydra, queue-runner, evaluator and postgres is managed
by foreman (https://github.com/ddollar/foreman) and configured
in `Procfile`.
2020-05-15 12:37:16 +02:00
Eelco Dolstra a614199449
Merge pull request #760 from knl/patch-1
Correct the link to hydra-api.yml file
2020-05-14 16:38:13 +02:00
Nikola Knežević 090c05be5d
Correct the link to hydra-api.yml file
The correct filename is `hydra-api.yml` not `hydra.yml`.
2020-05-14 14:15:30 +02:00
Eelco Dolstra 16ecd4f59d
Merge pull request #757 from grahamc/fixup-migration-p2
schema/Builds: use jobset_id instead of jobset name matches
2020-05-13 16:43:02 +02:00
Graham Christensen 548fd8eadd
schema/Builds: use jobset_id instead of jobset name matches
This was clearly an error in the original part-2 of the diff, and
specifically breaks when two projects have a jobset of the same name.
2020-05-13 10:12:56 -04:00
Bas van Dijk 301e4e088e
Merge pull request #756 from basvandijk/only-convert-integer-option-values-to-ints
GitInput: only convert integer option values to int
2020-05-13 12:09:20 +02:00
Bas van Dijk 38122544ed GitInput: only convert integer option values to int
The previous code converted option values to ints when the value
contained a digit somewhere. This is too eager since it also converts
strings like `release-0.2` to an int which should not happen.

We now only convert to int when the value is an integer.
2020-05-13 11:41:52 +02:00
Eelco Dolstra 15a45f1a8a
Fix build 2020-05-12 16:14:20 +02:00
Eelco Dolstra ace051e8d9
flake.lock: Update
Flake input changes:

* Updated 'nix': 'github:NixOS/nix/3aaceeb7e2d3fb8a07a1aa5a21df1dca6bbaa0ef' -> 'github:NixOS/nix/14a3a62bfca6c572b9a415cfa80cdbd7ad4326b3'
2020-05-12 16:03:29 +02:00
Eelco Dolstra e379628db0
hydra-eval-jobset: Pass --no-allow-import-from-derivation
https://github.com/NixOS/nixpkgs/issues/87592
2020-05-12 15:17:50 +02:00
Eelco Dolstra cb06f0af47
flake.nix: Remove edition field 2020-05-12 14:03:06 +02:00
Bas van Dijk c2bc84ddb7
Merge pull request #755 from knl/migrate-tests-to-the-python-DSL
Convert all tests to the Python DSL
2020-05-11 22:11:58 +02:00
Nikola Knezevic 3efa8223c9 Convert all tests to the Python DSL
Since Perl-based NixOS tests will be deprecated in nixpkgs 20.09, this
change migrates all tests to the new Python-based NixOS tests.
2020-05-11 22:05:30 +02:00
Tobias Pflug 41d70395e4
Add hydra OpenAPI description (#750)
* Add swagger config

* Add hydra api info to the README

* hydra.yaml: added some more descriptions

* Add /login

* Add 404/403 responses

* hydra.yaml -> hydra-api.yaml

* Address PR comments

- drop releases/releasename
- document dependency
- document defaultpath

* Fix syntax

* Add project creation

Add `PUT /project/{id}`

* Add /search

* Add "/api/jobsets" endpoint

* Add /api/push endpoint

* Add jobset PUT definition

* Add eval endpoint

* Remove duplicated key

* Fix typo

* Fix structural errors

* fix another error

* Link to hydra-api.yaml from master

* Add openapi yaml validation step to CI
2020-05-11 10:04:46 -04:00
Bas van Dijk f32a2a48d7
Merge pull request #740 from knl/add-githubrefs-plugin
Add GithubRefs plugin
2020-05-08 13:21:45 +02:00
Eelco Dolstra 88ef3e68a2
Merge pull request #752 from NixOS/remove-releases
Remove the "releases" feature
2020-05-06 18:20:45 +02:00
Eelco Dolstra 96a514c169
Remove the "releases" feature
We haven't used this in many years (it was really only used for nix
and patchelf releases).
2020-05-06 12:39:21 +02:00
Eelco Dolstra ace30b4184
Merge pull request #749 from lopsided98/localhost-no-remote
Don't distribute localhost builds to other builders
2020-05-04 16:36:53 +02:00
Eelco Dolstra 65819a225d
Merge pull request #748 from gilligan/flake-compat-comment
Add comment about edolstra/flake-compat
2020-05-04 16:36:00 +02:00
Ben Wolsieffer f020f7efef
hydra-queue-runner: don't try to distribute builds on localhost 2020-05-03 00:05:52 -04:00
Tobias Pflug 9d80a6de66 Add comment about edolstra/flake-compat
Add a comment to default.nix and shell.nix briefly outlining what
flake-compat/default.nix does.
2020-05-02 18:56:30 +02:00
Graham Christensen c82f51751d
Merge pull request #747 from gilligan/extend-readme
Extend Setup Information
2020-05-02 10:21:51 -04:00
Tobias Pflug c8c308c0e2 Extend Setup Information
Add information on how to create a minimal setup: project/jobset.
2020-05-02 16:04:20 +02:00
Graham Christensen fd38524843
Merge pull request #746 from gilligan/add-ci-badge
Add CI badge to README.md
2020-05-02 08:36:38 -04:00
Tobias Pflug 32c35ed6e6 Add CI badge to README.md 2020-05-02 14:29:19 +02:00
Graham Christensen 9f2a7f86b3
Merge pull request #745 from gilligan/remove-png
Remove .png
2020-05-02 08:24:35 -04:00
Tobias Pflug 8400b005f3 Remove .png
File was added to the repo by accident
2020-05-02 14:19:14 +02:00
Graham Christensen 4dcae3100e
Merge pull request #744 from gilligan/revamp-readme
Update README
2020-05-01 18:02:25 -04:00
Tobias Pflug d949726a6e
Update README.md
Co-authored-by: Graham Christensen <graham@grahamc.com>
2020-05-01 23:57:22 +02:00
Tobias Pflug cc7827f57a Update README
Revamp the whole text providing info on

- installation / setup via nixos module
- building via nix-build
- development environment via nix-shell
2020-05-01 23:28:36 +02:00
Eelco Dolstra 028bab462d
Merge pull request #738 from ehmry/sotest
Add SoTest plugin
2020-04-28 13:40:50 +02:00
Emery Hemingway e93c36aab1 SoTest: read credentials from file 2020-04-26 12:12:04 +05:30
Nikola Knezevic f03e7ef800 Add GithubRefs plugin
This plugin is a counterpart to GithubPulls plugin. Instead of fetching pull
requests, it will fetch all references (branches and tags) that start with a
particular prefix.

The plugin is a copy of GithubPulls plugin with appropriate changes to call the
right API and parse the config matching the need.
2020-04-23 10:45:37 +02:00
Emery Hemingway a63e349476 Add SoTest plugin
https://opensource.sotest.io/
https://docs.sotest.io/
2020-04-21 15:25:44 +05:30
Eelco Dolstra 87837f1d82
Merge pull request #737 from Ma27/rm-sqlite
Get rid of dependency to SQLite
2020-04-16 00:55:38 +02:00
Maximilian Bosch 16a8b4d086
Re-add DBDSQLite since it's needed by the Perl-bindings of Nix 2020-04-16 00:42:40 +02:00
Maximilian Bosch 721c764951
Remove Hydra::Helper::nix::txn_do from the Perl code
To quote the function's comment:

  Awful hack to handle timeouts in SQLite: just retry the transaction.
  DBD::SQLite *has* a 30 second retry window, but apparently it
  doesn't work.

Since SQLite is now dropped entirely, this wrapper can be removed
completely.
2020-04-16 00:42:40 +02:00
Maximilian Bosch efcbc08686
Get rid of dependency to SQLite
SQLite isn't properly supported by Hydra for a few years now[1], but
Hydra still depends on it. Apart from a slightly bigger closure this can
cause confusion by users since Hydra picks up SQLite rather than
PostgreSQL by default if HYDRA_DBI isn't configured properly[2]

[1] 78974abb69
[2] https://logs.nix.samueldr.com/nixos-dev/2020-04-10#3297342;
2020-04-16 00:42:40 +02:00