diff options
author | Harald Musum <musum@oath.com> | 2018-06-19 20:17:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-19 20:17:43 +0200 |
commit | c6a24ec54ad6a59b5b5c602d9358372c41c314f7 (patch) | |
tree | 9fa459b9a0a99ff405fe6ffee7cca53ab9aa2768 /controller-server/src/main/java/com/yahoo | |
parent | ebac96eb4bad36dfdb45e4d1c60706dc9da8f9e6 (diff) |
Revert "Jvenstad/hosted vespa deployment pipeline"
Diffstat (limited to 'controller-server/src/main/java/com/yahoo')
26 files changed, 120 insertions, 497 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java index 9208537dd98..295e0102782 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java @@ -21,7 +21,6 @@ import com.yahoo.vespa.hosted.controller.rotation.RotationId; import java.time.Instant; import java.util.Collections; import java.util.Comparator; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; 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 57708bfc89c..f0e278c3e6d 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 @@ -37,7 +37,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; import com.yahoo.vespa.hosted.controller.application.ApplicationVersion; import com.yahoo.vespa.hosted.controller.application.Deployment; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; +import com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType; import com.yahoo.vespa.hosted.controller.application.JobStatus; import com.yahoo.vespa.hosted.controller.application.JobStatus.JobRun; import com.yahoo.vespa.hosted.controller.application.SystemApplication; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java index 3f5f3369c0a..b65d3bc0849 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java @@ -25,9 +25,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.routing.GlobalRoutingSe import com.yahoo.vespa.hosted.controller.api.integration.routing.RotationStatus; import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry; -import com.yahoo.vespa.hosted.controller.deployment.DelegatingBuildService; -import com.yahoo.vespa.hosted.controller.deployment.InternalBuildService; -import com.yahoo.vespa.hosted.controller.deployment.JobController; import com.yahoo.vespa.hosted.controller.persistence.CuratorDb; import com.yahoo.vespa.hosted.controller.rotation.Rotation; import com.yahoo.vespa.hosted.controller.versions.VersionStatus; @@ -64,7 +61,6 @@ public class Controller extends AbstractComponent { private final CuratorDb curator; private final ApplicationController applicationController; private final TenantController tenantController; - private final JobController jobController; private final Clock clock; private final GitHub gitHub; private final EntityService entityService; @@ -118,15 +114,13 @@ public class Controller extends AbstractComponent { this.clock = Objects.requireNonNull(clock, "Clock cannot be null"); this.athenzClientFactory = Objects.requireNonNull(athenzClientFactory, "AthenzClientFactory cannot be null"); - jobController = new JobController(this); applicationController = new ApplicationController(this, curator, athenzClientFactory, Objects.requireNonNull(rotationsConfig, "RotationsConfig cannot be null"), Objects.requireNonNull(nameService, "NameService cannot be null"), configServer, Objects.requireNonNull(artifactRepository, "ArtifactRepository cannot be null"), Objects.requireNonNull(routingGenerator, "RoutingGenerator cannot be null"), - new DelegatingBuildService(Objects.requireNonNull(buildService, "BuildService cannot be null"), - new InternalBuildService(jobController)), + Objects.requireNonNull(buildService, "BuildService cannot be null"), clock); tenantController = new TenantController(this, curator, athenzClientFactory); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java index 79e7fa0295a..3207d4b8399 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java @@ -18,7 +18,7 @@ import com.yahoo.vespa.hosted.controller.application.ClusterInfo; import com.yahoo.vespa.hosted.controller.application.ClusterUtilization; import com.yahoo.vespa.hosted.controller.application.Deployment; import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; +import com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType; import com.yahoo.vespa.hosted.controller.application.DeploymentMetrics; import com.yahoo.vespa.hosted.controller.application.JobStatus; import com.yahoo.vespa.hosted.controller.rotation.RotationId; @@ -34,7 +34,7 @@ import java.util.OptionalLong; * An application that has been locked for modification. Provides methods for modifying an application's fields. * * @author mpolden - * @author jonmv + * @author jvenstad */ public class LockedApplication { @@ -158,7 +158,7 @@ public class LockedApplication { return with(deployments); } - public LockedApplication withoutDeploymentJob(JobType jobType) { + public LockedApplication withoutDeploymentJob(DeploymentJobs.JobType jobType) { return new LockedApplication(lock, id, deploymentSpec, validationOverrides, deployments, deploymentJobs.without(jobType), change, outstandingChange, ownershipIssueId, metrics, rotation); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/api/ActivateResult.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/api/ActivateResult.java index a890c50a0af..271942ff9a3 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/api/ActivateResult.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/api/ActivateResult.java @@ -8,7 +8,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.configserver.PrepareRes * @author Oyvind Gronnesby */ public class ActivateResult { - // TODO jvenstad: Replace this class with just the PrepareResponse. private final RevisionId revisionId; private final PrepareResponse prepareResponse; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/LogStore.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/LogStore.java deleted file mode 100644 index 608a6e6ae9f..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/LogStore.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.yahoo.vespa.hosted.controller.api.integration; - -import com.yahoo.config.provision.ApplicationId; -import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; - -public interface LogStore { - - /** Returns the log of the given deployment job. */ - String getTestLog(ApplicationId applicationId, ZoneId zoneId, int buildId); - - /** Stores the given log for the given deployment job. */ - void setTestLog(ApplicationId applicationId, ZoneId zoneId, int buildId, String log); - - /** Deletes the log for the given deployment job. */ - void deleteTestLog(ApplicationId applicationId, ZoneId zoneId, int buildId); - -} diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java deleted file mode 100644 index 93ca86486d3..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.yahoo.vespa.hosted.controller.api.integration.deployment; - -import com.google.common.collect.ImmutableMap; -import com.yahoo.config.provision.Environment; -import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.SystemName; -import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; -import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; - -import java.util.Optional; -import java.util.stream.Stream; - -/** Job types that exist in the build system */ -public enum JobType { -// | enum name ------------| job name ------------------| Zone in main system ---------------------------------------| Zone in CD system ------------------------------------------- - component ("component" , null , null ), - systemTest ("system-test" , ZoneId.from("test" , "us-east-1") , ZoneId.from("test" , "cd-us-central-1") ), - stagingTest ("staging-test" , ZoneId.from("staging", "us-east-3") , ZoneId.from("staging", "cd-us-central-1") ), - productionCorpUsEast1 ("production-corp-us-east-1" , ZoneId.from("prod" , "corp-us-east-1") , null ), - productionUsEast3 ("production-us-east-3" , ZoneId.from("prod" , "us-east-3") , null ), - productionUsWest1 ("production-us-west-1" , ZoneId.from("prod" , "us-west-1") , null ), - productionUsCentral1 ("production-us-central-1" , ZoneId.from("prod" , "us-central-1") , null ), - productionApNortheast1 ("production-ap-northeast-1" , ZoneId.from("prod" , "ap-northeast-1") , null ), - productionApNortheast2 ("production-ap-northeast-2" , ZoneId.from("prod" , "ap-northeast-2") , null ), - productionApSoutheast1 ("production-ap-southeast-1" , ZoneId.from("prod" , "ap-southeast-1") , null ), - productionEuWest1 ("production-eu-west-1" , ZoneId.from("prod" , "eu-west-1") , null ), - productionAwsUsEast1a ("production-aws-us-east-1a" , ZoneId.from("prod" , "aws-us-east-1a") , null ), - productionCdAwsUsEast1a("production-cd-aws-us-east-1a", null , ZoneId.from("prod" , "cd-aws-us-east-1a")), - productionCdUsCentral1 ("production-cd-us-central-1" , null , ZoneId.from("prod" , "cd-us-central-1") ), - productionCdUsCentral2 ("production-cd-us-central-2" , null , ZoneId.from("prod" , "cd-us-central-2") ); - - private final String jobName; - private final ImmutableMap<SystemName, ZoneId> zones; - - JobType(String jobName, ZoneId mainZone, ZoneId cdZone) { - this.jobName = jobName; - ImmutableMap.Builder<SystemName, ZoneId> builder = ImmutableMap.builder(); - if (mainZone != null) builder.put(SystemName.main, mainZone); - if (cdZone != null) builder.put(SystemName.cd, cdZone); - this.zones = builder.build(); - } - - public String jobName() { return jobName; } - - /** Returns the zone for this job in the given system, or empty if this job does not have a zone */ - public Optional<ZoneId> zone(SystemName system) { - return Optional.ofNullable(zones.get(system)); - } - - /** Returns whether this is a production job */ - public boolean isProduction() { return environment() == Environment.prod; } - - /** Returns whether this is an automated test job */ - public boolean isTest() { return environment() != null && environment().isTest(); } - - /** Returns the environment of this job type, or null if it does not have an environment */ - public Environment environment() { - switch (this) { - case component: return null; - case systemTest: return Environment.test; - case stagingTest: return Environment.staging; - default: return Environment.prod; - } - } - - /** Returns the region of this job type, or null if it does not have a region */ - public Optional<RegionName> region(SystemName system) { - return zone(system).map(ZoneId::region); - } - - public static Optional<JobType> fromOptionalJobName(String jobName) { - return Stream.of(values()) - .filter(jobType -> jobType.jobName.equals(jobName)) - .findAny(); - } - - public static JobType fromJobName(String jobName) { - return fromOptionalJobName(jobName) - .orElseThrow(() -> new IllegalArgumentException("Unknown job name '" + jobName + "'")); - } - - /** Returns the job type for the given zone */ - public static Optional<JobType> from(SystemName system, ZoneId zone) { - return Stream.of(values()) - .filter(job -> job.zone(system).filter(zone::equals).isPresent()) - .findAny(); - } - - /** Returns the job job type for the given environment and region or null if none */ - public static Optional<JobType> from(SystemName system, Environment environment, RegionName region) { - switch (environment) { - case test: return Optional.of(systemTest); - case staging: return Optional.of(stagingTest); - } - return from(system, ZoneId.from(environment, region)); - } - -} 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 4968e161a35..d3193fd486d 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,9 +3,12 @@ package com.yahoo.vespa.hosted.controller.application; import com.google.common.collect.ImmutableMap; import com.yahoo.config.provision.ApplicationId; +import com.yahoo.config.provision.Environment; +import com.yahoo.config.provision.RegionName; +import com.yahoo.config.provision.SystemName; import com.yahoo.vespa.hosted.controller.api.integration.BuildService; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId; +import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; import java.util.Collection; import java.util.HashMap; @@ -14,6 +17,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.OptionalLong; +import java.util.stream.Stream; /** * Information about which deployment jobs an application should run and their current status. @@ -118,6 +122,93 @@ public class DeploymentJobs { return id; } + /** Job types that exist in the build system */ + public enum JobType { +// | enum name ------------| job name ------------------| Zone in main system ---------------------------------------| Zone in CD system ------------------------------------------- + component ("component" , null , null ), + systemTest ("system-test" , ZoneId.from("test" , "us-east-1") , ZoneId.from("test" , "cd-us-central-1")), + stagingTest ("staging-test" , ZoneId.from("staging", "us-east-3") , ZoneId.from("staging", "cd-us-central-1")), + productionCorpUsEast1 ("production-corp-us-east-1" , ZoneId.from("prod" , "corp-us-east-1") , null ), + productionUsEast3 ("production-us-east-3" , ZoneId.from("prod" , "us-east-3") , null ), + productionUsWest1 ("production-us-west-1" , ZoneId.from("prod" , "us-west-1") , null ), + productionUsCentral1 ("production-us-central-1" , ZoneId.from("prod" , "us-central-1") , null ), + productionApNortheast1 ("production-ap-northeast-1" , ZoneId.from("prod" , "ap-northeast-1") , null ), + productionApNortheast2 ("production-ap-northeast-2" , ZoneId.from("prod" , "ap-northeast-2") , null ), + productionApSoutheast1 ("production-ap-southeast-1" , ZoneId.from("prod" , "ap-southeast-1") , null ), + productionEuWest1 ("production-eu-west-1" , ZoneId.from("prod" , "eu-west-1") , null ), + productionAwsUsEast1a ("production-aws-us-east-1a" , ZoneId.from("prod" , "aws-us-east-1a") , null ), + productionCdAwsUsEast1a("production-cd-aws-us-east-1a" , null , ZoneId.from("prod" , "cd-aws-us-east-1a")), + productionCdUsCentral1 ("production-cd-us-central-1", null , ZoneId.from("prod" , "cd-us-central-1")), + productionCdUsCentral2 ("production-cd-us-central-2", null , ZoneId.from("prod" , "cd-us-central-2")); + + private final String jobName; + private final ImmutableMap<SystemName, ZoneId> zones; + + JobType(String jobName, ZoneId mainZone, ZoneId cdZone) { + this.jobName = jobName; + ImmutableMap.Builder<SystemName, ZoneId> builder = ImmutableMap.builder(); + if (mainZone != null) builder.put(SystemName.main, mainZone); + if (cdZone != null) builder.put(SystemName.cd, cdZone); + this.zones = builder.build(); + } + + public String jobName() { return jobName; } + + /** Returns the zone for this job in the given system, or empty if this job does not have a zone */ + public Optional<ZoneId> zone(SystemName system) { + return Optional.ofNullable(zones.get(system)); + } + + /** Returns whether this is a production job */ + public boolean isProduction() { return environment() == Environment.prod; } + + /** Returns whether this is an automated test job */ + public boolean isTest() { return environment() != null && environment().isTest(); } + + /** Returns the environment of this job type, or null if it does not have an environment */ + public Environment environment() { + switch (this) { + case component: return null; + case systemTest: return Environment.test; + case stagingTest: return Environment.staging; + default: return Environment.prod; + } + } + + /** Returns the region of this job type, or null if it does not have a region */ + public Optional<RegionName> region(SystemName system) { + return zone(system).map(ZoneId::region); + } + + public static Optional<JobType> fromOptionalJobName(String jobName) { + return Stream.of(values()) + .filter(jobType -> jobType.jobName.equals(jobName)) + .findAny(); + } + + public static JobType fromJobName(String jobName) { + return fromOptionalJobName(jobName) + .orElseThrow(() -> new IllegalArgumentException("Unknown job name '" + jobName + "'")); + } + + /** Returns the job type for the given zone */ + public static Optional<JobType> from(SystemName system, ZoneId zone) { + return Stream.of(values()) + .filter(job -> job.zone(system).filter(zone::equals).isPresent()) + .findAny(); + } + + /** Returns the job job type for the given environment and region or null if none */ + public static Optional<JobType> from(SystemName system, Environment environment, RegionName region) { + switch (environment) { + case test: return Optional.of(systemTest); + case staging: return Optional.of(stagingTest); + } + return from(system, ZoneId.from(environment, region)); + } + + } + /** A job report. This class is immutable. */ public static class JobReport { diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/JobList.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/JobList.java index cd15556ba9b..90435e13a1b 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/JobList.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/JobList.java @@ -4,7 +4,7 @@ package com.yahoo.vespa.hosted.controller.application; import com.google.common.collect.ImmutableList; import com.yahoo.component.Version; import com.yahoo.vespa.hosted.controller.Application; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; +import com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType; import com.yahoo.vespa.hosted.controller.application.JobStatus.JobRun; import java.time.Instant; @@ -16,7 +16,7 @@ import java.util.function.Predicate; /** * A list of deployment jobs that can be filtered in various ways. * - * @author jonmv + * @author jvenstad */ public class JobList { diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/JobStatus.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/JobStatus.java index a06a3e00340..8d15db888fd 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/JobStatus.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/JobStatus.java @@ -2,7 +2,6 @@ package com.yahoo.vespa.hosted.controller.application; import com.yahoo.component.Version; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import java.time.Instant; import java.util.Objects; @@ -19,7 +18,7 @@ import static java.util.Objects.requireNonNull; */ public class JobStatus { - private final JobType type; + private final DeploymentJobs.JobType type; private final Optional<JobRun> lastTriggered; private final Optional<JobRun> lastCompleted; @@ -32,7 +31,7 @@ public class JobStatus { * Used by the persistence layer (only) to create a complete JobStatus instance. * Other creation should be by using initial- and with- methods. */ - public JobStatus(JobType type, Optional<DeploymentJobs.JobError> jobError, + public JobStatus(DeploymentJobs.JobType type, Optional<DeploymentJobs.JobError> jobError, Optional<JobRun> lastTriggered, Optional<JobRun> lastCompleted, Optional<JobRun> firstFailing, Optional<JobRun> lastSuccess) { requireNonNull(type, "jobType cannot be null"); @@ -46,14 +45,14 @@ public class JobStatus { this.jobError = jobError; // Never say we triggered component because we don't: - this.lastTriggered = type == JobType.component ? Optional.empty() : lastTriggered; + this.lastTriggered = type == DeploymentJobs.JobType.component ? Optional.empty() : lastTriggered; this.lastCompleted = lastCompleted; this.firstFailing = firstFailing; this.lastSuccess = lastSuccess; } /** Returns an empty job status */ - public static JobStatus initial(JobType type) { + public static JobStatus initial(DeploymentJobs.JobType type) { return new JobStatus(type, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); } @@ -83,7 +82,7 @@ public class JobStatus { return new JobStatus(type, jobError, lastTriggered, Optional.of(completion), firstFailing, lastSuccess); } - public JobType type() { return type; } + public DeploymentJobs.JobType type() { return type; } /** Returns true unless this job last completed with a failure */ public boolean isSuccess() { diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DelegatingBuildService.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DelegatingBuildService.java deleted file mode 100644 index d2159841c9d..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DelegatingBuildService.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.yahoo.vespa.hosted.controller.deployment; - -import com.yahoo.vespa.hosted.controller.api.integration.BuildService; - -/** - * Sends build jobs to an internal build system whenever it accepts them, or to an external one otherwise. - * - * @author jonmv - */ -public class DelegatingBuildService implements BuildService { - - private final BuildService external; - private final BuildService internal; - - public DelegatingBuildService(BuildService external, BuildService internal) { - this.external = external; - this.internal = internal; - } - - @Override - public void trigger(BuildJob buildJob) { - (internal.builds(buildJob) ? internal : external).trigger(buildJob); - } - - @Override - public JobState stateOf(BuildJob buildJob) { - return (internal.builds(buildJob) ? internal : external).stateOf(buildJob); - } - -} diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentSteps.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentSteps.java index 51c1e61ecb2..d399ef977ac 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentSteps.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentSteps.java @@ -7,7 +7,7 @@ import com.yahoo.config.provision.SystemName; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; import com.yahoo.vespa.hosted.controller.application.Deployment; import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; +import com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType; import com.yahoo.vespa.hosted.controller.application.JobStatus; import java.util.Collection; @@ -46,7 +46,7 @@ public class DeploymentSteps { /** Returns job status sorted according to deployment spec */ public List<JobStatus> sortBy(Collection<JobStatus> jobStatus) { - List<JobType> sortedJobs = jobs(); + List<DeploymentJobs.JobType> sortedJobs = jobs(); return jobStatus.stream() .sorted(comparingInt(job -> sortedJobs.indexOf(job.type()))) .collect(collectingAndThen(Collectors.toList(), Collections::unmodifiableList)); 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 e3b4b4cef8c..00b2a5c9b52 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 @@ -15,7 +15,7 @@ import com.yahoo.vespa.hosted.controller.application.ApplicationVersion; import com.yahoo.vespa.hosted.controller.application.Change; import com.yahoo.vespa.hosted.controller.application.Deployment; import com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobReport; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; +import com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType; import com.yahoo.vespa.hosted.controller.application.JobStatus; import com.yahoo.vespa.hosted.controller.application.JobStatus.JobRun; @@ -40,9 +40,9 @@ import static com.yahoo.vespa.hosted.controller.api.integration.BuildService.Bui import static com.yahoo.vespa.hosted.controller.api.integration.BuildService.JobState.idle; import static com.yahoo.vespa.hosted.controller.api.integration.BuildService.JobState.queued; import static com.yahoo.vespa.hosted.controller.api.integration.BuildService.JobState.running; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.component; -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 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.singletonList; import static java.util.Comparator.comparing; @@ -60,7 +60,7 @@ import static java.util.stream.Collectors.toList; * * @author bratseth * @author mpolden - * @author jonmv + * @author jvenstad */ public class DeploymentTrigger { diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalBuildService.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalBuildService.java deleted file mode 100644 index 74dffc1c4fd..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalBuildService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.yahoo.vespa.hosted.controller.deployment; - -import com.yahoo.vespa.hosted.controller.Controller; -import com.yahoo.vespa.hosted.controller.api.integration.BuildService; - -/** - * Wraps a JobController as a BuildService. - * - * Shall be inlined when the {@link DelegatingBuildService} delegates all jobs to it. - * - * @author jonmv - */ -public class InternalBuildService implements BuildService { - - private final JobController jobs; - - public InternalBuildService(JobController jobs) { - this.jobs = jobs; - } - - @Override - public void trigger(BuildJob buildJob) { - - } - - @Override - public JobState stateOf(BuildJob buildJob) { - return null; - } - - @Override - public boolean builds(BuildJob buildJob) { - return false; - } - -} 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 deleted file mode 100644 index 2d1040f7095..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.yahoo.vespa.hosted.controller.deployment; - -import com.yahoo.config.provision.ApplicationId; -import com.yahoo.vespa.hosted.controller.Controller; -import com.yahoo.vespa.hosted.controller.api.integration.LogStore; -import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; - -import java.util.List; - -/** - * A singleton owned by the controller, which contains the state and methods for controlling deployment jobs. - * - * Keys are the {@link ApplicationId} of the real application, for which the deployment job is run, and the - * {@link ZoneId} of the real deployment to test. - * - * Although the deployment jobs are themselves applications, their IDs are not to be referenced. - * - * @author jonmv - */ -public class JobController { - - private final Controller controller; - private final LogStore logs; - - public JobController(Controller controller) { - this.controller = controller; - this.logs = null; - } - - -// GET: - /** Returns whether the given application has registered with this build service. */ - boolean builds(ApplicationId application) { - return false; - } - - /** Returns a list of all application which have registered. */ - List<ApplicationId> applications() { - return null; - } - - /** Returns all job types which have been run for the given application. */ - List<ZoneId> jobs(ApplicationId application) { - return null; - } - - /** Returns a list of meta information about all known runs of the given job type. */ - List<JobMeta> runs(ApplicationId application, ZoneId zone) { - return null; - } - - /** Returns the current status of the given job. */ - JobMeta status(JobId job) { - return null; - } - - /** Returns the details for the given job. */ - JobDetails details(JobId job) { - return null; - } - - -// POST: - /** Registers the given application, such that it may have deployment jobs run here. */ - void register(ApplicationId application) { - ; - } - - /** Orders a run of the given type, and returns the id of the created job. */ - JobId run(ApplicationId application, ZoneId zone) { - return null; - } - - -// PUT: - /** Stores the given details for the given job. */ - void store(JobDetails details, JobId job) { - ; - } - - -// DELETE: - /** Unregisters the given application, and deletes all associated data. */ - void unregister(ApplicationId application) { - ; - } - - /** Aborts the given job. */ - void abort(JobId job) { - ; - } - -} diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobDetails.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobDetails.java deleted file mode 100644 index 3c787c8314f..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobDetails.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.yahoo.vespa.hosted.controller.deployment; - -import com.yahoo.vespa.hosted.controller.api.ActivateResult; - -/** - * Contains details about a deployment job run. - * - * @author jonmv - */ -public class JobDetails { - - private final ActivateResult deploymentResult; - private final String convergenceLog; - private final String testLog; - - public JobDetails(ActivateResult deploymentResult, String convergenceLog, String testLog) { - this.deploymentResult = deploymentResult; - this.convergenceLog = convergenceLog; - this.testLog = testLog; - } - -} diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobId.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobId.java deleted file mode 100644 index 541494a23fc..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobId.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.yahoo.vespa.hosted.controller.deployment; - -import com.yahoo.config.provision.ApplicationId; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; -import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; -import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; - -import java.util.Objects; - -/** - * Immutable ID of a job run by an {@link InternalBuildService}. - * - * @author jonmv - */ -public class JobId { - - private final ApplicationId application; - private final ZoneId zone; - private final long number; - - public JobId(ApplicationId application, ZoneId zone, long number) { - this.application = Objects.requireNonNull(application, "ApplicationId cannot be null!"); - this.zone = Objects.requireNonNull(zone, "ZoneId cannot be null!"); - if (number <= 0) throw new IllegalArgumentException("Build number must be a positive integer!"); - this.number = number; - } - - public ApplicationId application() { return application; } - public ZoneId zone() { return zone; } - public long number() { return number; } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if ( ! (o instanceof JobId)) return false; - - JobId id = (JobId) o; - - if (number != id.number) return false; - if ( ! application.equals(id.application)) return false; - return zone == id.zone; - } - - @Override - public int hashCode() { - int result = application.hashCode(); - result = 31 * result + zone.hashCode(); - result = 31 * result + (int) (number ^ (number >>> 32)); - return result; - } - - @Override - public String toString() { - return "Run " + number + " in " + zone + " for " + application; - } - -} diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobMeta.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobMeta.java deleted file mode 100644 index dde675402ce..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobMeta.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.yahoo.vespa.hosted.controller.deployment; - -import java.time.Instant; -import java.util.Optional; - -/** - * Contains state information for a deployment job run by an {@link InternalBuildService}. - * - * @author jonmv - */ -public class JobMeta { - - private final JobId id; - private final JobState state; - private final JobOutcome outcome; - private final Instant start; - private final Instant end; - - public JobMeta(JobId id, JobState state, JobOutcome outcome, Instant start, Instant end) { - this.id = id; - this.state = state; - this.outcome = outcome; - this.start = start; - this.end = end; - } - - public JobId id() { - return id; - } - - public JobState state() { - return state; - } - - public JobOutcome outcome() { - return outcome; - } - - public Instant start() { - return start; - } - - public Optional<Instant> end() { - return Optional.ofNullable(end); - } -} diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobOutcome.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobOutcome.java deleted file mode 100644 index caecdcffb9b..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobOutcome.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.yahoo.vespa.hosted.controller.deployment; - -/** - * Outcomes of jobs run by an {@link InternalBuildService}. - * - * @author jonmv - */ -public enum JobOutcome { - - /** Deployment of the real application was rejected due to missing capacity. */ - outOfCapacity, - - /** Deployment of the real application was rejected. */ - deploymentFailed, - - /** Convergence of the real application timed out. */ - convergenceFailed, - - /** Real application was deployed, but the tester application was not. */ - testError, - - /** Real application was deployed, but the tests failed. */ - testFailure, - - /** Deployment and tests completed with great success! */ - success, - - /** Job completed abnormally, due to user intervention or unexpected system error. */ - aborted - -} diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobState.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobState.java deleted file mode 100644 index 19e575efaf8..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobState.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.yahoo.vespa.hosted.controller.deployment; - -/** - * Status of jobs run by an {@link InternalBuildService}. - * - * @author jonmv - */ -public enum JobState { - - /** Job is not currently running, and may be started. */ - idle, - - /** Real application is deploying. */ - deploying, - - /** Real application is converging. */ - converging, - - /** Tester is starting up, but is not yet ready to serve its status. */ - initializing, - - /** Job is up and running normally. */ - running, - - /** Tests are complete, and results may be fetched. */ - finished - -} diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java index bf58bac177c..16f6378d2dc 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java @@ -3,7 +3,6 @@ package com.yahoo.vespa.hosted.controller.deployment; import com.yahoo.component.Version; import com.yahoo.vespa.hosted.controller.Application; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.application.ApplicationVersion; import com.yahoo.vespa.hosted.controller.application.Change; import com.yahoo.vespa.hosted.controller.application.Deployment; @@ -11,6 +10,8 @@ import com.yahoo.vespa.hosted.controller.application.JobStatus; import java.util.Optional; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.component; + /** * Source and target versions for an application. * @@ -101,7 +102,7 @@ public class Versions { Optional<Deployment> deployment) { return max(deployment.map(Deployment::applicationVersion), change.application()) .orElse(application.oldestDeployedApplication() - .orElse(application.deploymentJobs().jobStatus().get(JobType.component) + .orElse(application.deploymentJobs().jobStatus().get(component) .lastSuccess() .get() .application())); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java index 8db7231c207..1a6bce2dba9 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmer.java @@ -22,7 +22,7 @@ import java.util.logging.Level; * * When to file new issues, escalate inactive ones, etc., is handled by the enclosed OwnershipIssues. * - * @author jonmv + * @author jvenstad */ public class ApplicationOwnershipConfirmer extends Maintainer { diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporter.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporter.java index 91eda31d779..d471e553bb9 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporter.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporter.java @@ -28,7 +28,7 @@ import static com.yahoo.vespa.hosted.controller.versions.VespaVersion.Confidence * Maintenance job which files issues for tenants when they have jobs which fails continuously * and escalates issues which are not handled in a timely manner. * - * @author jonmv + * @author jvenstad */ public class DeploymentIssueReporter extends Maintainer { diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java index d804afdf98e..96d252d3d1c 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java @@ -13,7 +13,6 @@ import com.yahoo.slime.Slime; import com.yahoo.vespa.config.SlimeUtils; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.api.integration.MetricsService.ApplicationMetrics; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; import com.yahoo.vespa.hosted.controller.application.ApplicationVersion; @@ -399,8 +398,8 @@ public class ApplicationSerializer { private Optional<JobStatus> jobStatusFromSlime(Inspector object) { // if the job type has since been removed, ignore it - Optional<JobType> jobType = - JobType.fromOptionalJobName(object.field(jobTypeField).asString()); + Optional<DeploymentJobs.JobType> jobType = + DeploymentJobs.JobType.fromOptionalJobName(object.field(jobTypeField).asString()); if (! jobType.isPresent()) return Optional.empty(); Optional<JobError> jobError = Optional.empty(); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java index d6c0bf23da6..76a8eaec5d9 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java @@ -48,7 +48,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzClientFact import com.yahoo.vespa.hosted.controller.api.integration.athenz.ZmsException; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerException; import com.yahoo.vespa.hosted.controller.api.integration.configserver.Log; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.api.integration.organization.User; import com.yahoo.vespa.hosted.controller.api.integration.routing.RotationStatus; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; @@ -857,7 +856,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { } return new DeploymentJobs.JobReport( ApplicationId.from(tenantName, applicationName, report.field("instance").asString()), - JobType.fromJobName(report.field("jobName").asString()), + DeploymentJobs.JobType.fromJobName(report.field("jobName").asString()), report.field("projectId").asLong(), report.field("buildNumber").asLong(), toSourceRevision(report.field("sourceRevision")), diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java index 26d0b1868ae..c1a2c575fc2 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiHandler.java @@ -10,7 +10,7 @@ import com.yahoo.slime.Cursor; import com.yahoo.slime.Slime; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.api.integration.BuildService; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; +import com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType; import com.yahoo.vespa.hosted.controller.restapi.ErrorResponse; import com.yahoo.vespa.hosted.controller.restapi.Path; import com.yahoo.vespa.hosted.controller.restapi.SlimeJsonResponse; |