summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2022-09-07 12:56:54 +0200
committerGitHub <noreply@github.com>2022-09-07 12:56:54 +0200
commit08c96c1b360c09af40b65533c4827b8b61cc1232 (patch)
tree9e5f9f7eca56625a4a88e0c8fba978e0f3f685a9 /controller-server
parent153111cfd6f7eca10a59b82f90dc9f6fb3773d22 (diff)
parent472ab42728c9f339a095a3396c34766bf2c4fce9 (diff)
Merge pull request #23963 from vespa-engine/bratseth/warn-on-old-major
Bratseth/warn on old major
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java64
1 files changed, 45 insertions, 19 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 11a784ce899..31ac0606a1f 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
@@ -570,25 +570,7 @@ public class JobController {
application = application.withRevisions(revisions -> revisions.with(version.get()));
application = withPrunedPackages(application, version.get().id());
- TestSummary testSummary = TestPackage.validateTests(submission.applicationPackage().deploymentSpec(), submission.testPackage());
- if (testSummary.problems().isEmpty())
- controller.notificationsDb().removeNotification(NotificationSource.from(id), Type.testPackage);
- else
- controller.notificationsDb().setNotification(NotificationSource.from(id),
- Type.testPackage,
- Notification.Level.warning,
- testSummary.problems());
-
- submission.applicationPackage().parentVersion().ifPresent(parent -> {
- if (parent.getMajor() < controller.readSystemVersion().getMajor())
- controller.notificationsDb().setNotification(NotificationSource.from(id),
- Type.submission,
- Notification.Level.warning,
- "Parent version used to compile the application is on a " +
- "lower major version than the current Vespa Cloud version");
- else
- controller.notificationsDb().removeNotification(NotificationSource.from(id), Type.submission);
- });
+ validate(id, submission);
applications.storeWithUpdatedConfig(application, submission.applicationPackage());
if (application.get().projectId().isPresent())
@@ -597,6 +579,50 @@ public class JobController {
return version.get();
}
+ private void validate(TenantAndApplicationId id, Submission submission) {
+ validateTests(id, submission);
+ validateParentVersion(id, submission);
+ validateMajorVersion(id, submission);
+ }
+
+ private void validateTests(TenantAndApplicationId id, Submission submission) {
+ TestSummary testSummary = TestPackage.validateTests(submission.applicationPackage().deploymentSpec(), submission.testPackage());
+ if (testSummary.problems().isEmpty())
+ controller.notificationsDb().removeNotification(NotificationSource.from(id), Type.testPackage);
+ else
+ controller.notificationsDb().setNotification(NotificationSource.from(id),
+ Type.testPackage,
+ Notification.Level.warning,
+ testSummary.problems());
+
+ }
+
+ private void validateParentVersion(TenantAndApplicationId id, Submission submission) {
+ submission.applicationPackage().parentVersion().ifPresent(parent -> {
+ if (parent.getMajor() < controller.readSystemVersion().getMajor())
+ controller.notificationsDb().setNotification(NotificationSource.from(id),
+ Type.submission,
+ Notification.Level.warning,
+ "Parent version used to compile the application is on a " +
+ "lower major version than the current Vespa Cloud version");
+ else
+ controller.notificationsDb().removeNotification(NotificationSource.from(id), Type.submission);
+ });
+ }
+
+ private void validateMajorVersion(TenantAndApplicationId id, Submission submission) {
+ submission.applicationPackage().deploymentSpec().majorVersion().ifPresent(explicitMajor -> {
+ if (explicitMajor < 8)
+ controller.notificationsDb().setNotification(NotificationSource.from(id),
+ Type.applicationPackage,
+ Notification.Level.warning,
+ "Vespa 7 will soon be end of life, upgrade to Vespa 8 now:" +
+ "https://cloud.vespa.ai/en/vespa8-release-notes.html");
+ else
+ controller.notificationsDb().removeNotification(NotificationSource.from(id), Type.applicationPackage);
+ });
+ }
+
private LockedApplication withPrunedPackages(LockedApplication application, RevisionId latest){
TenantAndApplicationId id = application.get().id();
Application wrapped = application.get();