summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <jvenstad@yahoo-inc.com>2018-04-23 15:22:15 +0200
committerJon Marius Venstad <jvenstad@yahoo-inc.com>2018-04-23 15:22:15 +0200
commitac66027dc8f884b8dc85676c53c61369db9488dc (patch)
treee72fcbefe9c4a639e90f070feae85040ec92c73d
parent892f76c6a9ab672dc58c2950e03ea9ebc2a69383 (diff)
Add method used in condition
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java
index 31d56fefe18..b11b432c27f 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java
@@ -47,6 +47,7 @@ import static com.yahoo.vespa.hosted.controller.api.integration.BuildService.Bui
import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.component;
import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest;
import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest;
+import static java.util.Collections.emptyList;
import static java.util.Collections.emptySet;
import static java.util.Collections.singletonList;
import static java.util.Comparator.comparing;
@@ -295,6 +296,8 @@ public class DeploymentTrigger {
else if (testJobs == null) {
if ( ! alreadyTriggered(application, target))
testJobs = testJobsFor(application, target, "Testing deployment for " + job.jobName(), completedAt.orElse(clock.instant()));
+ else
+ testJobs = emptyList();
}
}
}
@@ -351,6 +354,18 @@ public class DeploymentTrigger {
return true;
}
+ private Optional<Instant> testedAt(Application application, State target) {
+ return max(successOn(application, systemTest, target).map(JobRun::at),
+ successOn(application, stagingTest, target).map(JobRun::at));
+ }
+
+ private boolean alreadyTriggered(Application application, State target) {
+ return ! JobList.from(application).production()
+ .lastTriggered().on(target.targetPlatform)
+ .lastTriggered().on(target.targetApplication)
+ .isEmpty();
+ }
+
/**
* Returns the instant when the given change is complete for the given application for the given job.
*