summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2022-09-19 12:52:59 +0200
committerjonmv <venstad@gmail.com>2022-09-19 12:52:59 +0200
commit7a15cf437464ae6bf6b9e39594fd891f9ef38c83 (patch)
treec049474772b6543ca090b40c164873ba6856857e /controller-server
parentab2675727a96f22d4042be83cea86826f5b469aa (diff)
Refine check for whether app is/was on old major
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java9
2 files changed, 11 insertions, 2 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java
index cc1263531df..6b8ecc95cd9 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentStatus.java
@@ -176,10 +176,12 @@ public class DeploymentStatus {
if (allowOutdatedPlatform)
return augmented;
+ // If compatibility platform is present, require that jobs have previously been run on that platform's major.
+ // If platform is not present, app is already on the (old) platform iff. it has production deployments.
boolean alreadyDeployedOnPlatform = augmented.platform().map(platform -> allJobs.production().asList().stream()
.anyMatch(job -> job.runs().values().stream()
.anyMatch(run -> run.versions().targetPlatform().getMajor() == platform.getMajor())))
- .orElse(false);
+ .orElse( ! application.productionDeployments().values().stream().allMatch(List::isEmpty));
// Verify target platform is either current, or was previously deployed for this app.
if (augmented.platform().isPresent() && ! versionStatus.isOnCurrentMajor(augmented.platform().get()) && ! alreadyDeployedOnPlatform)
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java
index 89b6f6ca606..f7d74373ac7 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java
@@ -2315,6 +2315,7 @@ public class DeploymentTriggerTest {
.getMessage());
tester.deploymentTrigger().forceChange(old.instanceId(), Change.of(version0), false);
+ tester.deploymentTrigger().cancelChange(old.instanceId(), ALL);
// Not even version incompatibility tricks the system.
tester.controllerTester().flagSource().withListFlag(PermanentFlags.INCOMPATIBLE_VERSIONS.id(), List.of("7"), String.class);
@@ -2326,11 +2327,17 @@ public class DeploymentTriggerTest {
.build()))
.getMessage());
+ // Submit new revision on old major
+ old.submit(new ApplicationPackageBuilder().region("us-central-1").region("us-east-3").region("us-west-1")
+ .compileVersion(version0)
+ .build())
+ .deploy();
+
// Upgrade.
old.submit(new ApplicationPackageBuilder().region("us-central-1").region("us-east-3").region("us-west-1")
.compileVersion(version1)
.build())
- .deploy();
+ .deploy();
// And downgrade again.
old.submit(new ApplicationPackageBuilder().region("us-central-1").region("us-east-3").region("us-west-1")