summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerij Fredriksen <freva@users.noreply.github.com>2022-10-11 15:33:12 +0200
committerGitHub <noreply@github.com>2022-10-11 15:33:12 +0200
commite9a3193205ddc97927b25731b09fa10afcdac659 (patch)
tree2ccf45471f45d0efc35794b84ea4964470c19a5d
parent6f52488c63635cee4a9657f0f1ceedee905d60be (diff)
parentb0c65e09beeb62e33cf9160c9408a3382c6f1328 (diff)
Merge pull request #24385 from vespa-engine/jonmv/clear-outdated-job-notifications
Clear notifications when ending jobs that are no longer declared
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
index 46c93c019ee..e685e5d167e 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
@@ -77,6 +77,7 @@ import static com.yahoo.vespa.hosted.controller.deployment.RunStatus.noTests;
import static com.yahoo.vespa.hosted.controller.deployment.RunStatus.nodeAllocationFailure;
import static com.yahoo.vespa.hosted.controller.deployment.RunStatus.reset;
import static com.yahoo.vespa.hosted.controller.deployment.RunStatus.running;
+import static com.yahoo.vespa.hosted.controller.deployment.RunStatus.success;
import static com.yahoo.vespa.hosted.controller.deployment.RunStatus.testFailure;
import static com.yahoo.vespa.hosted.controller.deployment.Step.Status.succeeded;
import static com.yahoo.vespa.hosted.controller.deployment.Step.copyVespaLogs;
@@ -763,14 +764,18 @@ public class InternalStepRunner implements StepRunner {
private Optional<RunStatus> report(RunId id, DualLogger logger) {
try {
+ boolean isRemoved = ! id.type().environment().isManuallyDeployed()
+ && ! controller.jobController().deploymentStatus(controller.applications().requireApplication(TenantAndApplicationId.from(id.application())))
+ .jobSteps().containsKey(id.job());
+
controller.jobController().active(id).ifPresent(run -> {
if (run.status() == reset)
return;
- if (run.hasFailed())
+ if (run.hasFailed() && ! isRemoved)
sendEmailNotification(run, logger);
- updateConsoleNotification(run);
+ updateConsoleNotification(run, isRemoved);
});
}
catch (IllegalStateException e) {
@@ -820,10 +825,10 @@ public class InternalStepRunner implements StepRunner {
.orElse(true);
}
- private void updateConsoleNotification(Run run) {
+ private void updateConsoleNotification(Run run, boolean isRemoved) {
NotificationSource source = NotificationSource.from(run.id());
Consumer<String> updater = msg -> controller.notificationsDb().setNotification(source, Notification.Type.deployment, Notification.Level.error, msg);
- switch (run.status()) {
+ switch (isRemoved ? success : run.status()) {
case aborted: return; // wait and see how the next run goes.
case noTests:
case running: