aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-12-16 11:21:30 +0100
committerJon Marius Venstad <venstad@gmail.com>2021-12-16 11:21:30 +0100
commit2d319a7e67b6d09e425e24f006fb3f0ecce7e438 (patch)
tree1ed32bc7d4932e3fd0e4efb7cbf5d538bddd80ea /controller-server/src/main/java
parente0f6590ad9f5c941f45e540475d43044f3c3786a (diff)
Avoid re-sesnding email for repeated failures
Diffstat (limited to 'controller-server/src/main/java')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java9
1 files changed, 9 insertions, 0 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 e28273870d7..0d56bc286eb 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
@@ -737,6 +737,9 @@ public class InternalStepRunner implements StepRunner {
/** Sends a mail with a notification of a failed run, if one should be sent. */
private void sendEmailNotification(Run run, DualLogger logger) {
+ if ( ! isNewFailure(run))
+ return;
+
Application application = controller.applications().requireApplication(TenantAndApplicationId.from(run.id().application()));
Notifications notifications = application.deploymentSpec().requireInstance(run.id().application().instance()).notifications();
boolean newCommit = application.require(run.id().application().instance()).change().application()
@@ -760,6 +763,12 @@ public class InternalStepRunner implements StepRunner {
}
}
+ private boolean isNewFailure(Run run) {
+ return controller.jobController().lastCompleted(run.id().job())
+ .map(previous -> ! previous.hasFailed() || ! previous.versions().targetsMatch(run.versions()))
+ .orElse(true);
+ }
+
private void updateConsoleNotification(Run run) {
NotificationSource source = NotificationSource.from(run.id());
Consumer<String> updater = msg -> controller.notificationsDb().setNotification(source, Notification.Type.deployment, Notification.Level.error, msg);