diff --git a/doc/manual/src/notifications.md b/doc/manual/src/notifications.md index 2423670c..0c666559 100644 --- a/doc/manual/src/notifications.md +++ b/doc/manual/src/notifications.md @@ -55,6 +55,30 @@ After processing, the row's `notificationspendingsince` column is set to null. It is possible for subsequent deliveries of the same `build_finished` data to imply different outcomes. For example, if the build fails, is restarted, and then succeeds. In this scenario the `build_finished` events will be delivered at least twice, once for the failure and then once for the success. +### `eval_started` + +* **Payload:** Exactly three values, separated by the two-character string `\t` (ie: not a tab): an opaque trace ID representing this evaluation, the name of the project, and the name of the jobset. +* **When:** At the beginning of the evaluation phase for the jobset, before any work is done. +* **Delivery Semantics:** Ephemeral. `hydra-notify` must be running to react to this event. No record of this event is stored. + +### `eval_added` + +* **Payload:** Exactly two values, separated by the two-character string `\t` (ie: not a tab): an opaque trace ID representing this evaluation, and the ID of the JobsetEval record. +* **When:** After the evaluator fetches inputs and completes the evaluation successfully. +* **Delivery Semantics:** Ephemeral. `hydra-notify` must be running to react to this event. No record of this event is stored. + +### `eval_cached` + +* **Payload:** Exactly one value: an opaque trace ID representing this evaluation. +* **When:** After the evaluator fetches inputs, if none of the inputs changed. +* **Delivery Semantics:** Ephemeral. `hydra-notify` must be running to react to this event. No record of this event is stored. + +### `eval_failed` + +* **Payload:** Exactly one value: an opaque trace ID representing this evaluation. +* **When:** After any fetching any input fails, or any other evaluation error occurs. +* **Delivery Semantics:** Ephemeral. `hydra-notify` must be running to react to this event. No record of this event is stored. + ## Development Notes ### Re-sending a notification diff --git a/src/lib/Hydra/Event.pm b/src/lib/Hydra/Event.pm index 9efeda67..86cf9055 100644 --- a/src/lib/Hydra/Event.pm +++ b/src/lib/Hydra/Event.pm @@ -2,20 +2,20 @@ package Hydra::Event; use strict; use warnings; -use Hydra::Event::CachedBuildFinished; -use Hydra::Event::CachedBuildQueued; use Hydra::Event::BuildFinished; use Hydra::Event::BuildQueued; use Hydra::Event::BuildStarted; +use Hydra::Event::CachedBuildFinished; +use Hydra::Event::CachedBuildQueued; use Hydra::Event::StepFinished; my %channels_to_events = ( + build_finished => \&Hydra::Event::BuildFinished::parse, build_queued => \&Hydra::Event::BuildQueued::parse, build_started => \&Hydra::Event::BuildStarted::parse, - step_finished => \&Hydra::Event::StepFinished::parse, - build_finished => \&Hydra::Event::BuildFinished::parse, cached_build_finished => \&Hydra::Event::CachedBuildFinished::parse, cached_build_queued => \&Hydra::Event::CachedBuildQueued::parse, + step_finished => \&Hydra::Event::StepFinished::parse, ); diff --git a/t/Event/CachedBuildFinished.t b/t/Hydra/Event/CachedBuildFinished.t similarity index 100% rename from t/Event/CachedBuildFinished.t rename to t/Hydra/Event/CachedBuildFinished.t diff --git a/t/Event/CachedBuildQueued.t b/t/Hydra/Event/CachedBuildQueued.t similarity index 100% rename from t/Event/CachedBuildQueued.t rename to t/Hydra/Event/CachedBuildQueued.t diff --git a/t/Hydra/Event/StepFinished.t b/t/Hydra/Event/StepFinished.t index 08726566..1d18e9b1 100644 --- a/t/Hydra/Event/StepFinished.t +++ b/t/Hydra/Event/StepFinished.t @@ -7,7 +7,7 @@ my %ctx = test_init(); require Hydra::Schema; require Hydra::Model::DB; use Hydra::Event; -use Hydra::Event::BuildStarted; +use Hydra::Event::StepFinished; use Test2::V0; use Test2::Tools::Exception; diff --git a/t/scripts/hydra-eval-jobset/notifications.t b/t/scripts/hydra-eval-jobset/notifications.t index d0bbb3af..8fe5d0f4 100644 --- a/t/scripts/hydra-eval-jobset/notifications.t +++ b/t/scripts/hydra-eval-jobset/notifications.t @@ -17,14 +17,14 @@ path_input_cache_validity_seconds = 0 my $dbh = $ctx->db()->storage->dbh; my $listener = Hydra::PostgresListener->new($dbh); +$listener->subscribe("build_queued"); +$listener->subscribe("builds_added"); $listener->subscribe("cached_build_finished"); $listener->subscribe("cached_build_queued"); -$listener->subscribe("build_queued"); -$listener->subscribe("eval_failed"); -$listener->subscribe("eval_cached"); $listener->subscribe("eval_added"); +$listener->subscribe("eval_cached"); +$listener->subscribe("eval_failed"); $listener->subscribe("eval_started"); -$listener->subscribe("builds_added"); my $jobsetdir = $ctx->tmpdir . '/jobset';