Commit graph

262 commits

Author SHA1 Message Date
Maximilian Bosch 5ae26aa760
Update Nix to 2.6 2022-02-06 15:05:15 +01:00
Graham Christensen d8b56f022d RunCommand: print a warning if the hook isn't run because the project / jobset doens't have it enabled 2022-02-01 10:58:54 -05:00
Graham Christensen 38514ae494 fanout tests: capture warnings and test their relevance 2022-02-01 10:58:54 -05:00
Graham Christensen 2635607b6e whoops: add a test on the enable_dynamic_run_command field 2022-02-01 10:58:54 -05:00
Graham Christensen 1affb1cfb1 jobset API: expose and check the enable_dynamic_run_command 2022-02-01 10:58:54 -05:00
Graham Christensen 726ea80e99 HTTP/Jobset: support setting / reading enable_dynamic_run_command 2022-02-01 10:58:54 -05:00
Graham Christensen 0810f5debc finish making the dynamic hooks only run on project & jobset agreement 2022-02-01 10:58:54 -05:00
Graham Christensen 0c96172c28 RunCommand: only run dynamic runcommand hooks if the project AND jobset agree they should be enabled 2022-02-01 10:58:54 -05:00
Graham Christensen 3cce0c5ef6 Only run dynamic runcommand hooks if the jobset enables them 2022-02-01 10:57:30 -05:00
Graham Christensen 216d8bee35 DynamicRunCommand: don't run if the build failed 2022-02-01 10:57:30 -05:00
Graham Christensen 1a30a0c2f1 Dynamic RunCommand: validate that the job's out exists, is a file (or points to a file) which is executable. 2022-02-01 10:57:30 -05:00
Graham Christensen c2be27e82b fanout.t: switch to makeAndEvaluateJobset 2022-02-01 10:57:30 -05:00
Graham Christensen e7f68045f4 DynamicRunCommand: pull out the function determining if a build is
eligible for execution under dynamic run commands.
2022-02-01 10:57:30 -05:00
Graham Christensen e56c49333f RunCommand: Add a WIP execution of dynamic commands
This in-progress feature will run a dynamically generated set of
buildFinished hooks, which must be nested under the `runCommandHook.*`
attribute set. This implementation is not very good, with some to-dos:

1. Only run if the build succeeded
2. Verify the output is named $out and that it is an executable file
   (or a symlink to a file)
3. Require the jobset itself have a flag enabling the feature, since
   this feature can be a bit dangerous if various people of different
   trust levels can create the jobs.
2022-02-01 10:57:30 -05:00
Graham Christensen ea311a0eb4 RunCommand: enable the plugin if dynamicruncommand is set 2022-02-01 10:57:30 -05:00
Cole Helbling 61189ecca9 Helper/Nix: constructRunCommandLogPath: verify uuid is valid
This shouldn't be possible normally, but it is possible to:

    $db->resultset('RunCommandLogs')->new({ uuid => "../etc/passwd" });

if you have access to the `$db`.
2022-01-31 08:58:33 -08:00
Cole Helbling 2c6487b8d7 t/Helper: test constructRunCommandLogPath 2022-01-31 08:58:33 -08:00
Cole Helbling 8bf3cdbc67 t/Helper: switch to using test_context() 2022-01-31 08:58:33 -08:00
Cole Helbling 8eab7b8543 Helper/Nix: constructRunCommandLogPath: take RunCommandLog as input
This way we ensure that it actually exists in the database, rather than
blindly trusting user-generated input.
2022-01-31 08:58:33 -08:00
Cole Helbling 38896db6b6 t/RunCommand: init http.t
Test that we can indeed visit the pages of a valid runcommand log and
not of an invalid one.
2022-01-31 08:58:33 -08:00
Cole Helbling 47c1f89d5a t/RunCommand: fixup basic.t to use uuid 2022-01-31 08:58:33 -08:00
Graham Christensen dcb0c1425c RunCommandLogs: set a UUID automatically 2022-01-31 08:58:33 -08:00
Cole Helbling 3e722f1d0a t/RunCommand: remove duplicate use 2022-01-28 13:07:11 -08:00
Cole Helbling 988e79c6e5 t/RunCommand: test that the log file exists on the filesystem 2022-01-28 13:07:11 -08:00
Graham Christensen c280692f91
Merge pull request #1126 from DeterminateSystems/build-localhost-paths
build-remote: copy missing paths from the binary cache to localhost
2022-01-21 16:16:33 -05:00
Graham Christensen 952f629b7c Test the queue runner in the scenario where a dependency is available in the cache but GC'd locally, where we're building locally 2022-01-21 15:26:45 -05:00
Graham Christensen 5c3e48fd0d CliRunners: decode UTF8 before printing stderr/stdout
Fixes yath output. It used to say:

    step â is now runnable

Now it says:

    step ‘/run...2ipqz6hbc41m4c5w5bkq-dependent-job.drv’ is now runnable
2022-01-21 15:24:33 -05:00
Graham Christensen e4407f8c93 HydraTestContext: expose the nix state dir 2022-01-21 15:12:10 -05:00
Graham Christensen 0eeced7f08 hydra-create-user: Warn that creating users with a plaintext password is deprecated 2022-01-21 12:56:15 -05:00
Graham Christensen 98928a4125 fixups 2022-01-21 12:52:06 -05:00
Graham Christensen bb893d0bd5 hydra-create-user: support prompting for passwords
I'm not sure this is a good implementation as-is. It does work,
but the password gets echo'd to the screen. I tried to use IO::Prompt
but IO::Prompt really seems to want to read the password from ARGV.
2022-01-21 10:40:56 -05:00
Graham Christensen 3a6c25489c Hydra::Helper::Nix: expose a captureStdoutStderrWithStdin, make it available in tests 2022-01-21 10:40:06 -05:00
Graham Christensen 4945306a2b hydra-create-user: make docs about using --password-hash better 2022-01-21 10:39:22 -05:00
Graham Christensen 12d0d0c176 hydra-create-user: use test_context over test_init 2022-01-21 10:37:48 -05:00
Graham Christensen bb9864bad7 hydra-create-user.t: rename the various users based on their password type 2022-01-21 09:12:47 -05:00
Graham Christensen 9671d4d135
Merge pull request #1119 from DeterminateSystems/project-jobset/update-gc-roots
Project jobset: update-gc-roots
2022-01-15 15:57:06 -05:00
Graham Christensen 52dda56b99 hydra-update-gc-roots: add a very basic test validating successful execution 2022-01-15 14:20:11 -05:00
Graham Christensen b2cdde0901 DeclarativeJobsets: test basic functionality 2022-01-15 13:46:32 -05:00
Graham Christensen eef633c1cc tests: create a declarative project spec and the autoconfig machinery 2022-01-15 13:46:32 -05:00
Graham Christensen 2abcd84931
Merge pull request #1115 from DeterminateSystems/project-jobset/builds-json-repr
Project jobset: update builds json repr
2022-01-15 12:09:45 -05:00
Graham Christensen cb68629417 test a Build's json representation 2022-01-14 21:19:48 -05:00
Graham Christensen f4c4b496d8 Projects: delete: delete all builds first
Deleting jobsets first would fail because buildmetrics has an FK
to the jobset. However, the jobset / project relationship is not
marked as CASCADE.

Deleting all the builds automatically cascades to delete
buildmetrics, so deleting the relevant builds first, then deleting
the jobset solves it.
2022-01-14 20:37:55 -05:00
Graham Christensen 0044622198 Projects: test deleting 2022-01-14 20:36:52 -05:00
Graham Christensen 8ae2daece7 root: test /steps and /evals 2022-01-14 16:49:58 -05:00
Graham Christensen e0e8840d8f Test /search 2022-01-14 16:38:25 -05:00
Graham Christensen 42a871e413
Merge pull request #1111 from DeterminateSystems/project-jobset/queue-summary-machines
Project jobset columns: fixup /queue-summary and /machines
2022-01-14 15:34:43 -05:00
Graham Christensen bdccad573c machines: test 2022-01-14 15:23:19 -05:00
Graham Christensen da516f70a4 queue summary: test 2022-01-14 15:23:19 -05:00
Graham Christensen a81e358016 API: test api/push-github 2022-01-14 14:57:32 -05:00
Graham Christensen 20db82b001 API test /api/push 2022-01-14 14:57:24 -05:00
Graham Christensen fe095a56c5 API: test /nrbuilds and fix jobset / project references 2022-01-14 14:57:15 -05:00
Graham Christensen e5c8a35423 API: test fetching the queue and latestbuilds 2022-01-14 14:57:03 -05:00
Graham Christensen 8383679bf6 test /queue and /status, both of which use buildListColumns 2022-01-14 12:48:51 -05:00
Graham Christensen 59d0259220 test /eval/ID/channel works
Uses buildListColumns
2022-01-14 12:48:51 -05:00
Graham Christensen 2de40f86ec test /job/PROJECT/JOBSET/JOB works
Uses buildListColumns
2022-01-14 12:48:51 -05:00
Graham Christensen 4a07622195 test /job/PROJECT/JOBSET/JOB/prometheus works
Uses buildListColumns
2022-01-14 12:48:51 -05:00
Graham Christensen b37ca88fd5 test /job/PROJECT/JOBSET/JOB/shield works
Uses buildListColumns
2022-01-14 12:48:51 -05:00
Graham Christensen 796cae0fd0 Test Job's builds and channel pages 2022-01-14 11:52:07 -05:00
Graham Christensen a2adb8cfb6 Test Jobset's builds and channel pages 2022-01-14 11:28:39 -05:00
Graham Christensen 23d7046522 t/Controller/Build/constituents.t: assert the response is valid JSON, dump if it isn't 2022-01-14 11:28:39 -05:00
Graham Christensen 9291cba89f Project: tests we can get the channel for the latest builds 2022-01-14 11:28:39 -05:00
Graham Christensen dcefb88373 test /project/NAME/all returns a 200 2022-01-14 11:28:39 -05:00
Graham Christensen 6d5b234ba2 hydra-eval-jobset/notification.t: comment which jobs produced which messages
I tried to write the test in such a way to assert the content matched
what we expected, but since the ordering of them is not known, it
is quite tricky to write.
2022-01-14 09:13:17 -05:00
Graham Christensen 42edd3a9d8 hydra-notify: respond to cached_build_queued 2022-01-14 09:13:17 -05:00
Graham Christensen 6b7f1da11e hydra-notify: operate on cached_build_finished events 2022-01-14 09:13:17 -05:00
Graham Christensen 4da80e736e hydra-eval-jobset: send notifications when cached queued / finished builds are submitted 2022-01-11 13:28:04 -05:00
Graham Christensen 769f56f793
Merge pull request #1101 from DeterminateSystems/hydra-eval-jobset-notifications
hydra-eval-jobset: test emitted notifications
2022-01-11 13:23:44 -05:00
Graham Christensen 2e195c524d evalSucceds/evalFails: log that the success or failure was not expected 2022-01-11 13:10:43 -05:00
Graham Christensen 2b163aa78b CatalystUtils::showJobName: write a basic test that shows it works 2022-01-11 11:48:02 -05:00
Graham Christensen 0ada412979 hydra-eval-jobset: write a test validating the events that comes out 2022-01-11 10:17:14 -05:00
Graham Christensen ae38cc5d04 test_context: support an override on jobsdir when creating a jobset 2022-01-11 10:17:14 -05:00
Graham Christensen 8d4c448e92 t: create a evalFails helper 2022-01-11 10:17:14 -05:00
Graham Christensen 40e556aee5 tests: evalSucceeds: don't print stdout/stderr unless it fails 2022-01-11 10:17:14 -05:00
Graham Christensen ca6ba409de Relocate new tests in to the Hydra subdir 2022-01-11 09:54:51 -05:00
Graham Christensen b41818e067
Merge pull request #1100 from DeterminateSystems/nest-tests
Tests: restructure to more closely mirror the sources
2022-01-11 09:53:16 -05:00
Graham Christensen a5d1d36fa6 Tests: restructure to more closely mirror the sources
t/ had lots of directories and files mirroring src/lib/Hydra. This moves
those files under t/Hydra
2022-01-10 15:34:52 -05:00
Cole Helbling 92bd0fae7d t/BuildDiff: test jobs without previous history 2022-01-10 12:11:06 -08:00
Cole Helbling 1ca786561f t/JobsetEval: test GETing the eval page 2022-01-10 12:11:05 -08:00
Cole Helbling 157a02bff7 t/BuildDiff: slightly refactor empty test to be more readable 2022-01-10 12:11:05 -08:00
Cole Helbling 220ccc68df t/BuildDiff: test diffing two jobs 2022-01-10 12:11:05 -08:00
Cole Helbling 0c51f3ca7d BuildDiff: make actual hash ref 2022-01-10 12:11:05 -08:00
Cole Helbling 0eb952d72d t/BuildDiff: init 2022-01-10 12:11:05 -08:00
Graham Christensen 98c88a4dbf
Merge pull request #1097 from DeterminateSystems/api-test-warnings
Api test warnings: clean up
2022-01-10 14:03:38 -05:00
Graham Christensen d8025fcf04 api-test.t: don't print request content
It adds noise to the logs
2022-01-10 11:02:01 -05:00
Graham Christensen 6b2f0a9fe1 api-test.t: set a default method 2022-01-10 11:02:01 -05:00
Cole Helbling 35f55279c1 HydraTestContext: prefix names with t
This is necessary because jobset and project names are not allowed to
begin with a digit, and yet the generated jobset and project names would
do just that.

Not the most elegant solution, but it works.
2022-01-10 09:39:42 -05:00
Graham Christensen 06360bfbb6 RunCommandLogs.t: use test_context to get a specific build
Fixes a build error: Can't use global @_ in 'my' at Schema/Result/RunCommandLogs.t line 20, near ', @_'
2022-01-07 15:05:33 -05:00
Graham Christensen a7aeb766aa RunCommandLogs: add a helper for if it failed with an exec error 2022-01-07 15:05:33 -05:00
Graham Christensen d849856dcd RunCommandLogs: add helpers for if it is running/failed/signaled 2022-01-07 15:05:33 -05:00
Graham Christensen c81acbf93e RunCommandLogs: test recording a signaled process without a core dump 2022-01-07 15:05:33 -05:00
Graham Christensen d003fec8a5 RunCommandLogs: add a did_succeed helper 2022-01-07 15:05:33 -05:00
Graham Christensen 5bb3e2be78 Record the errno if exec fails 2022-01-07 15:05:33 -05:00
Graham Christensen 4ce8239cea RunCommand: create run logs for each execution 2022-01-07 15:05:33 -05:00
Graham Christensen a14501c616 Tasks: only execute the event if the plugin is interested in it 2021-12-21 20:57:53 -05:00
Graham Christensen d195e545f5 hydra-notify: listen for build_queued events 2021-12-21 20:57:53 -05:00
Graham Christensen f2f8d571f3 queue-runner-status: fixup from perlcritic-level-2
>
> from_json was legacy / deprecated. This was the only use.
2021-12-15 17:24:23 -05:00
Graham Christensen fbce3b6ed1 default-machine-file: use makeAndEvaluateJobset 2021-12-14 20:52:40 -05:00
Graham Christensen 06f824ca48 notifications.t: use system() with lists 2021-12-14 20:48:19 -05:00
Graham Christensen 5836bc9a11 HydraTestContext::makeAndEvaluateJobset: make a random user 2021-12-14 20:48:07 -05:00
Graham Christensen c2384a04d8 notifications.t: move to makeAndEvaluateJobset 2021-12-14 20:41:21 -05:00