summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2019-11-07 16:45:21 +0100
committerJon Marius Venstad <venstad@gmail.com>2019-11-07 16:45:21 +0100
commit8b133ea876d8673ea016e28bb05f847271cdcc7d (patch)
tree8cecc03bbf208ca76c350dde5135b757f0fb167e /controller-server
parent7b013a8fb1ec2157050703661cf4742c0bc286e2 (diff)
Remove BuildService
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java2
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java22
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java8
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobStatus.java2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java11
7 files changed, 11 insertions, 39 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
index 90c3fabf2d6..d28df826957 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
@@ -147,7 +147,7 @@ public class ApplicationController {
routingPolicies = new RoutingPolicies(controller);
rotationRepository = new RotationRepository(rotationsConfig, this, curator);
- deploymentTrigger = new DeploymentTrigger(controller, controller.serviceRegistry().buildService(), clock);
+ deploymentTrigger = new DeploymentTrigger(controller, clock);
provisionApplicationCertificate = Flags.PROVISION_APPLICATION_CERTIFICATE.bindTo(controller.flagSource());
applicationPackageValidator = new ApplicationPackageValidator(controller);
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java
index fb238e0a652..e126128ce2e 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java
@@ -3,10 +3,8 @@ package com.yahoo.vespa.hosted.controller.application;
import com.google.common.collect.ImmutableMap;
import com.yahoo.config.provision.ApplicationId;
-import com.yahoo.vespa.hosted.controller.api.integration.BuildService;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.SourceRevision;
import java.util.Collection;
import java.util.LinkedHashMap;
@@ -116,7 +114,6 @@ public class DeploymentJobs {
public boolean success() { return ! jobError.isPresent(); }
public Optional<ApplicationVersion> version() { return version; }
public Optional<JobError> jobError() { return jobError; }
- public BuildService.BuildJob buildJob() { return BuildService.BuildJob.of(applicationId, projectId, jobType.jobName()); }
}
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 8b38ed13b28..d0f34857b06 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
@@ -12,7 +12,7 @@ import com.yahoo.vespa.hosted.controller.ApplicationController;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.Instance;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
-import com.yahoo.vespa.hosted.controller.api.integration.BuildService;
+import com.yahoo.vespa.hosted.controller.api.identifiers.InstanceId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
@@ -29,7 +29,6 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
@@ -42,7 +41,6 @@ import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import static com.yahoo.vespa.hosted.controller.api.integration.BuildService.BuildJob;
import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest;
import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.systemTest;
import static java.util.Collections.emptyList;
@@ -80,7 +78,7 @@ public class DeploymentTrigger {
private final Clock clock;
private final JobController jobs;
- public DeploymentTrigger(Controller controller, BuildService buildService, Clock clock) {
+ public DeploymentTrigger(Controller controller, Clock clock) {
this.controller = Objects.requireNonNull(controller, "controller cannot be null");
this.clock = Objects.requireNonNull(clock, "clock cannot be null");
this.jobs = controller.jobController();
@@ -152,11 +150,6 @@ public class DeploymentTrigger {
});
}
- /** Returns a map of jobs that are scheduled to be run, grouped by the job type */
- public Map<JobType, ? extends List<? extends BuildJob>> jobsToRun() {
- return computeReadyJobs().stream().collect(groupingBy(Job::jobType));
- }
-
/**
* Finds and triggers jobs that can and should run but are currently not, and returns the number of triggered jobs.
*
@@ -437,7 +430,7 @@ public class DeploymentTrigger {
private List<JobType> runningProductionJobs(Map<JobType, JobStatus> status) {
return status.values().parallelStream()
.filter(job -> job.isRunning())
- .map(job -> job.job().type())
+ .map(job -> job.id().type())
.filter(JobType::isProduction)
.collect(toList());
}
@@ -497,7 +490,7 @@ public class DeploymentTrigger {
public boolean alreadyTriggered(Map<JobType, JobStatus> status, Versions versions) {
return status.values().stream()
- .filter(job -> job.job().type().isProduction())
+ .filter(job -> job.id().type().isProduction())
.anyMatch(job -> job.lastTriggered()
.map(Run::versions)
.filter(versions::targetsMatch)
@@ -575,9 +568,9 @@ public class DeploymentTrigger {
// ---------- Data containers ----------
- // TODO jonmv: Replace with a JobSpec class not based on BuildJob.
- private static class Job extends BuildJob {
+ private static class Job {
+ private final ApplicationId instanceId;
private final JobType jobType;
private final JobRun triggering;
private final Instant availableSince;
@@ -586,7 +579,7 @@ public class DeploymentTrigger {
private Job(Instance instance, JobRun triggering, JobType jobType, Instant availableSince,
boolean isRetry, boolean isApplicationUpgrade) {
- super(instance.id(), 0L, jobType.jobName());
+ this.instanceId = instance.id();
this.jobType = jobType;
this.triggering = triggering;
this.availableSince = availableSince;
@@ -594,6 +587,7 @@ public class DeploymentTrigger {
this.isApplicationUpgrade = isApplicationUpgrade;
}
+ ApplicationId applicationId() { return instanceId; }
JobType jobType() { return jobType; }
Instant availableSince() { return availableSince; } // TODO jvenstad: This is 95% broken now. Change.at() can restore it.
boolean isRetry() { return isRetry; }
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 e22b70050ab..331327117b5 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
@@ -1,17 +1,14 @@
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.deployment;
-import com.google.common.collect.ImmutableMap;
import com.yahoo.component.Version;
import com.yahoo.config.application.api.DeploymentSpec;
import com.yahoo.config.provision.ApplicationId;
-import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.curator.Lock;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.Instance;
-import com.yahoo.vespa.hosted.controller.LockedApplication;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.NotFoundException;
@@ -34,10 +31,8 @@ import java.security.cert.X509Certificate;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -45,7 +40,6 @@ import java.util.NavigableMap;
import java.util.Optional;
import java.util.Set;
import java.util.SortedMap;
-import java.util.TreeMap;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
@@ -296,7 +290,7 @@ public class JobController {
return new DeploymentSteps(spec.requireInstance(id.instance()), controller::system)
.jobs().stream()
.map(type -> jobStatus(new JobId(id, type)))
- .collect(Collectors.toUnmodifiableMap(status -> status.job().type(),
+ .collect(Collectors.toUnmodifiableMap(status -> status.id().type(),
status -> status));
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobStatus.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobStatus.java
index a338a766727..52d60aca388 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobStatus.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobStatus.java
@@ -30,7 +30,7 @@ public class JobStatus {
this.firstFailing = firstFailing(runs);
}
- public JobId job() {
+ public JobId id() {
return id;
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java
index c96d1648041..ff6a5d3795f 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java
@@ -19,10 +19,8 @@ import com.yahoo.vespa.flags.InMemoryFlagSource;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.DeployOptions;
import com.yahoo.vespa.hosted.controller.api.identifiers.Property;
import com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId;
-import com.yahoo.vespa.hosted.controller.api.integration.BuildService;
import com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzClientFactoryMock;
import com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzDbMock;
-import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.dns.MemoryNameService;
import com.yahoo.vespa.hosted.controller.api.integration.dns.Record;
import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordName;
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java
index 83d9d4d1ad0..eced161cebc 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ServiceRegistryMock.java
@@ -23,7 +23,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerato
import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGeneratorMock;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.DummyOwnershipIssues;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.LoggingDeploymentIssues;
-import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockBuildService;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMailer;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMeteringClient;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockRunDataStore;
@@ -57,7 +56,6 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg
private final MockTesterCloud mockTesterCloud = new MockTesterCloud();
private final ApplicationStoreMock applicationStoreMock = new ApplicationStoreMock();
private final MockRunDataStore mockRunDataStore = new MockRunDataStore();
- private final MockBuildService mockBuildService = new MockBuildService();
private final MockTenantCost mockTenantCost = new MockTenantCost();
public ServiceRegistryMock(SystemName system) {
@@ -170,11 +168,6 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg
}
@Override
- public MockBuildService buildService() {
- return mockBuildService;
- }
-
- @Override
public MemoryNameService nameService() {
return memoryNameService;
}
@@ -211,10 +204,6 @@ public class ServiceRegistryMock extends AbstractComponent implements ServiceReg
return artifactRepositoryMock;
}
- public MockBuildService buildServiceMock() {
- return mockBuildService;
- }
-
public ApplicationCertificateMock applicationCertificateMock() {
return applicationCertificateMock;
}