From 8085bc4115ea7b1392457e62b1ac1824edb6a90d Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Wed, 20 Feb 2019 14:22:24 +0100 Subject: Application fails due to missing tester package --- .../vespa/hosted/controller/deployment/InternalStepRunnerTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java index d6365eff807..686cd1c8dfa 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java @@ -73,10 +73,14 @@ public class InternalStepRunnerTest { tester.setEndpoints(appId, JobType.productionUsWest1.zone(tester.tester().controller().system())); tester.setEndpoints(appId, JobType.productionUsEast3.zone(tester.tester().controller().system())); + // Let application have an ongoing upgrade when it switches (but kill the jobs, as the tester assumes they aren't running). + tester.tester().upgradeSystem(new Version("7.1")); + tester.tester().buildService().clear(); + tester.deployNewSubmission(); tester.deployNewSubmission(); - tester.deployNewPlatform(new Version("7.1")); + tester.deployNewPlatform(new Version("7.2")); tester.jobs().unregister(appId); try { -- cgit v1.2.3 From 34dac09e2b53529c3ac77de87bbe699e4f69a8dc Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Wed, 20 Feb 2019 14:23:19 +0100 Subject: Cancelling any ongoing upgrade solves the problem --- .../com/yahoo/vespa/hosted/controller/deployment/JobController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java index 063248071fb..6e3b6110efb 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java @@ -236,9 +236,11 @@ public class JobController { .map(Deployment::applicationVersion) .distinct() .forEach(appVersion -> { - byte[] content = controller.applications().artifacts().getApplicationPackage(application.get().id(), appVersion.id()); - controller.applications().applicationStore().put(application.get().id(), appVersion, content); + byte[] content = controller.applications().artifacts().getApplicationPackage(id, appVersion.id()); + controller.applications().applicationStore().put(id, appVersion, content); }); + // Make sure any ongoing upgrade is cancelled, since future jobs will require the tester artifact. + application = application.withChange(application.get().change().withoutPlatform().withoutApplication()); } long run = nextBuild(id); -- cgit v1.2.3 From f86887dc1f25c1fd7edaef7c5c32f6532828cff2 Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Wed, 20 Feb 2019 14:26:57 +0100 Subject: Send mail only when there are recipients --- .../controller/deployment/InternalStepRunner.java | 51 +++++++++++----------- 1 file changed, 26 insertions(+), 25 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 51d4033044f..c1194244dd8 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 @@ -453,31 +453,32 @@ public class InternalStepRunner implements StepRunner { private void sendNotification(Run run, DualLogger logger) { Application application = controller.applications().require(run.id().application()); Notifications notifications = application.deploymentSpec().notifications(); - if (notifications != Notifications.none()) { - boolean newCommit = application.change().application() - .map(run.versions().targetApplication()::equals) - .orElse(false); - When when = newCommit ? failingCommit : failing; - - List recipients = new ArrayList<>(notifications.emailAddressesFor(when)); - if (notifications.emailRolesFor(when).contains(author)) - run.versions().targetApplication().authorEmail().ifPresent(recipients::add); - - try { - if (run.status() == outOfCapacity && run.id().type().isProduction()) - controller.mailer().send(mails.outOfCapacity(run.id(), recipients)); - if (run.status() == deploymentFailed) - controller.mailer().send(mails.deploymentFailure(run.id(), recipients)); - if (run.status() == installationFailed) - controller.mailer().send(mails.installationFailure(run.id(), recipients)); - if (run.status() == testFailure) - controller.mailer().send(mails.testFailure(run.id(), recipients)); - if (run.status() == error) - controller.mailer().send(mails.systemError(run.id(), recipients)); - } - catch (RuntimeException e) { - logger.log(INFO, "Exception trying to send mail for " + run.id(), e); - } + boolean newCommit = application.change().application() + .map(run.versions().targetApplication()::equals) + .orElse(false); + When when = newCommit ? failingCommit : failing; + + List recipients = new ArrayList<>(notifications.emailAddressesFor(when)); + if (notifications.emailRolesFor(when).contains(author)) + run.versions().targetApplication().authorEmail().ifPresent(recipients::add); + + if (recipients.isEmpty()) + return; + + try { + if (run.status() == outOfCapacity && run.id().type().isProduction()) + controller.mailer().send(mails.outOfCapacity(run.id(), recipients)); + if (run.status() == deploymentFailed) + controller.mailer().send(mails.deploymentFailure(run.id(), recipients)); + if (run.status() == installationFailed) + controller.mailer().send(mails.installationFailure(run.id(), recipients)); + if (run.status() == testFailure) + controller.mailer().send(mails.testFailure(run.id(), recipients)); + if (run.status() == error) + controller.mailer().send(mails.systemError(run.id(), recipients)); + } + catch (RuntimeException e) { + logger.log(INFO, "Exception trying to send mail for " + run.id(), e); } } -- cgit v1.2.3