Commit graph

3480 commits

Author SHA1 Message Date
Graham Christensen e14175fc36
Merge pull request #895 from Mic92/fix-hydra-send-stats
hydra-send-stats: fix imports
2021-03-20 11:52:34 -04:00
Graham Christensen 425c7ff17f
hydra-send-stats: add a --once option for testing 2021-03-20 09:16:08 -04:00
Jörg Thalheim 6bb180a0f2
hydra-send-stats: fix imports 2021-03-20 09:16:04 -04:00
Graham Christensen 6f662a606a
hydra-send-stats: add a failing test asserting it can run 2021-03-20 09:14:14 -04:00
Graham Christensen 6b7ca554f9
Update src/lib/Hydra/Helper/Escape.pm: fewer ()s
Co-authored-by: Stig <stig@stig.io>
2021-03-18 16:27:21 -04:00
Graham Christensen 019aef3d41
Test the fake derivations channel, asserting nested packages are properly represented.
This is a breaking change. Previously, packages named `packageset.foo`
would be exposed in the fake derivation channel as `packageset-foo`.

Presumably this was done to avoid needing to track attribute sets, and
to avoid the complexity. I think this now correctly handles the
complexity and properly mirrors the input expressions layout.
2021-03-18 11:33:37 -04:00
Graham Christensen 88e0198a8e
Create a helper for dealing with nested attribute sets 2021-03-18 11:33:36 -04:00
Graham Christensen d62a2c1657
NixExprs: extract the escape function and test it 2021-03-18 11:24:17 -04:00
Eelco Dolstra aeb3d2f44c
Merge pull request #892 from grahamc/hydra-queue-runner-build-one
hydra-queue-runner: --build-one: correctly handle a cached build
2021-03-16 21:28:32 +01:00
Graham Christensen 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
Graham Christensen cab187a19d
Merge pull request #891 from grahamc/bug-889
Fixup #717 "Add the project name to declarative inputs"
2021-03-16 09:58:53 -04:00
Janne Heß 3c86083d21
Fixup #717 "Add the project name to declarative inputs"
```
Mar 10 16:22:35 hydra-b hydra-evaluator[41419]: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st execute failed: ERROR:  null value in column "type" violates not-null constraint
Mar 10 16:22:35 hydra-b hydra-evaluator[41419]: DETAIL:  Failing row contains (62358, projectName, 0, null, null, null, hackworthltd, null, , null). [for Statement "INSERT INTO jobsetevalinputs ( altnr, dependency, eval, name, path, revision, sha256hash, type, uri, value) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 1='0', 2=undef, 3='62358', 4='projectName', 5='', 6=undef, 7=undef, 8=undef, 9=undef, 10='hackworthltd'] at /nix/store/cmqblv437mp57yz5lwvkzcqca4ldf3r5-hydra-0.1.20210308.ebf1cd2/bin/.hydra-eval-jobset-wrapped line 793
Mar 10 16:22:35 hydra-b hydra-evaluator[25828]: evaluation of jobset ‘hackworthltd:.jobsets (jobset#1)’ failed with exit code 1
```

Use the abstraction for creating inputs for simulating the project
name input.

Co-authored-by: Graham Christensen <graham@grahamc.com>
2021-03-16 09:52:36 -04:00
Shea Levy 930f05c38e
Bump Nix version 2021-03-10 12:53:03 -05:00
Graham Christensen b9fb66401b
Merge pull request #880 from grahamc/runcommand-finished-bool
RunCommand: emit the `finished` field as a boolean
2021-03-09 09:58:43 -05:00
Graham Christensen 2179b4b4b0
RunCommand: emit the finished field as a boolean 2021-03-08 12:11:20 -05:00
Graham Christensen ebf1cd22ef
Merge pull request #717 from helsinki-systems/projectname
Add the project name to declarative inputs
2021-03-08 11:42:38 -05:00
Janne Heß 9e018d5443
Add the project name to declarative inputs
This allows for more generic declarative configurations which can be
shared between projects.
2021-03-08 17:36:52 +01:00
Graham Christensen a2717b3d7e
Merge pull request #886 from grahamc/269
statsd: add a chance to set hostname and port in hydra.conf
2021-03-08 11:23:43 -05:00
Matej Cotman a551fba346
statsd: add a chance to set hostname and port in hydra.conf
Co-authored-by: Graham Christensen <graham@grahamc.com>
2021-03-08 10:03:16 -05:00
Graham Christensen 1f4183e05f
Merge pull request #885 from mcsaucy/patch-1
Make nix-build args copy-pastable via `set -x`
2021-03-07 08:14:49 -05:00
Josh McSavaney e0d3a1c1a5
Make nix-build args copy-pastable via set -x
A reproduce script includes a logline that may resemble:

> using these flags: --arg nixpkgs { outPath = /tmp/build-137689173/nixpkgs/source; rev = "fdc872fa200a32456f12cc849d33b1fdbd6a933c"; shortRev = "fdc872f"; revCount = 273100; } -I nixpkgs=/tmp/build-137689173/nixpkgs/source --arg officialRelease false --option extra-binary-caches https://hydra.nixos.org/ --option system x86_64-linux /tmp/build-137689173/nixpkgs/source/pkgs/top-level/release.nix -A 

These are passed along to nix-build and that's fine and dandy, but you can't just copy-paste this as is, as the `{}` introduces a syntax error and the value accompanying `-A` is `''`.

A very naive approach is to just `printf "%q"` the individual args, which makes them safe to copy-paste. Unfortunately, this looks awful due to the liberal usage of slashes:

```
$ printf "%q" '{ outPath = /tmp/build-137689173/nixpkgs/source; rev = "fdc872fa200a32456f12cc849d33b1fdbd6a933c"; shortRev = "fdc872f"; revCount = 273100; }'
\{\ outPath\ =\ /tmp/build-137689173/nixpkgs/source\;\ rev\ =\ \"fdc872fa200a32456f12cc849d33b1fdbd6a933c\"\;\ shortRev\ =\ \"fdc872f\"\;\ revCount\ =\ 273100\;\ \}
```

Alternatively, if we just use `set -x` before we execute nix-build, we'll get the whole invocation in a friendly, copy-pastable format that nicely displays `{}`-enclosed content and preserves the empty arg following `-A`:

```
running nix-build...
using this invocation: 
+ nix-build --arg nixpkgs '{ outPath = /tmp/build-138165173/nixpkgs/source; rev = "e0e4484f2c028d2269f5ebad0660a51bbe46caa4"; shortRev = "e0e4484"; revCount = 274008; }' -I nixpkgs=/tmp/build-138165173/nixpkgs/source --arg officialRelease false --option extra-binary-caches https://hydra.nixos.org/ --option system x86_64-linux /tmp/build-138165173/nixpkgs/source/pkgs/top-level/release.nix -A ''
```
2021-03-06 23:25:26 -05:00
Graham Christensen de2f30f035
Merge pull request #883 from cole-h/bare-yath-test
Trivially run tests with `yath test`
2021-03-05 14:04:16 -05:00
Cole Helbling 2befb2c1e1
doc: document how to run tests
Both `make check` and `make && yath test` are now documented ways to
run the test suite.
2021-03-05 09:49:06 -08:00
Cole Helbling 025be052b7
tests: move to t, allow yath test from root
By moving the tests subdirectory to t, we gain the ability to run `yath
test` with no arguments from inside `nix develop` in the root of the
the repo.

(`nix develop` is necessary in order to set the proper env vars for
`yath` to find our test libraries.)
2021-03-05 09:49:06 -08:00
Graham Christensen a8ec1b1afa
Merge pull request #884 from cole-h/perl-cleanup
tests: replace the flat list of contexts with a hash
2021-03-05 12:45:21 -05:00
Cole Helbling 014778344c
tests: remove unnecessary Cwd imports 2021-03-04 23:48:48 -08:00
Cole Helbling 9a3af13c51
tests: add jobsdir and testdir to ctx hash
This allows us to calculate those directories only once, and just pass
them around as necessary.
2021-03-04 23:19:48 -08:00
Graham Christensen f08d0be1bd
tests: replace the flat list of contexts with a hash
This way we can return more values without breaking callers.
2021-03-04 23:11:54 -08:00
Graham Christensen 26cfe624d5
Merge pull request #882 from cole-h/split-inputtype-test
tests/input-types: split out scminputs into individual tests
2021-03-04 17:13:22 -05:00
Cole Helbling 387fe8005a
tests/input-types: split out scminputs into individual tests
This makes the test faster (by removing it and replacing it with a
`TestScmInput` module that exports the `testScmInput` subroutine). Now,
all the input tests can be run in parallel.

Some of the `tests/jobs/*-update.sh` scripts were "broken" (e.g. tests
failed for various reasons on my machine), so I fixed those up as well.

Co-authored-by: gustavderdrache <gustavderdrache@gmail.com>
2021-03-04 13:58:48 -08:00
Graham Christensen 572a0c0abd
Merge pull request #881 from cole-h/hydra-dbi
module: append `application_name` to HYDRA_DBI
2021-03-04 10:07:01 -05:00
Cole Helbling fe70160008
module: append application_name to HYDRA_DBI
This will make it easier to track specifically where queries are being
made from (assuming a `log_line_prefix` that includes `%a` in the
postgres configuration).
2021-03-03 16:02:52 -08:00
Graham Christensen 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
Eelco Dolstra 3cd312fc4c
Merge pull request #879 from grahamc/runcommand-meta
RunCommand: pass homepage, description, license, system, and nixname
2021-02-25 09:59:19 +01:00
Graham Christensen a756614fa1
RunCommand: pass homepage, description, license, system, and nixname 2021-02-24 16:13:09 -05:00
Eelco Dolstra 6fb9a2bbf5
Merge pull request #878 from grahamc/test-runcommand
Test RunCommand's behavior
2021-02-24 21:42:14 +01:00
Graham Christensen 3fda37f65a
RunCommand: Test 2021-02-24 13:43:25 -05:00
Graham Christensen b2520267a9
Test setup: support arbitrary hydra config 2021-02-24 11:44:16 -05:00
Graham Christensen 8d3633594b
Merge pull request #876 from grahamc/per-test-db
Create an ephemeral PostgreSQL database and Nix store per test, split up tests.
2021-02-24 07:59:18 -05:00
Graham Christensen cccdc70162
input-types.t: don't litter ./tests/ 2021-02-24 07:01:32 -05:00
Graham Christensen 611d7b71f2
input-types: use is() for test comparisons 2021-02-24 07:01:32 -05:00
Graham Christensen 371826f931
Tests: build-products: use is for good errors on failures 2021-02-24 07:01:32 -05:00
Graham Christensen 0df9c68422
Relocate the final evalutation tests to a build-products specific test. 2021-02-24 07:01:31 -05:00
Graham Christensen 2776ae6c78
Move tests for SCM inputs in to its own .t 2021-02-24 07:01:31 -05:00
Graham Christensen c8df544046
evaluate-dependent-jobsets: clean up test to be more clear 2021-02-24 07:01:31 -05:00
Graham Christensen 0b693ad8e8
Use is in evaluate-dependent-jobsets 2021-02-24 07:01:31 -05:00
Graham Christensen 9590bababc
Split out dependent tests in to its own .t 2021-02-24 07:01:25 -05:00
Graham Christensen e4cda87b5a
db.hh: use hasPrefix for prefix comparisons
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2021-02-24 07:00:26 -05:00
Graham Christensen 62b2880dfc
Give each test its own Nix directories
Otherwise we risk tripping over confusing statuses where a build is
"done" and "Cached", but we were expecting to run it.
2021-02-23 21:43:54 -05:00
Graham Christensen fe1f2f0806
Create an ephemeral PostgreSQL database per test 2021-02-23 21:12:06 -05:00