diff options
59 files changed, 259 insertions, 643 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/BuildService.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/BuildService.java index e91a5909f80..bb2de87796b 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/BuildService.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/BuildService.java @@ -4,7 +4,7 @@ package com.yahoo.vespa.hosted.controller.api.integration; import com.yahoo.config.provision.ApplicationId; /** - * @author jonmv + * @author jvenstad */ public interface BuildService { @@ -20,11 +20,6 @@ public interface BuildService { */ JobState stateOf(BuildJob buildJob); - /** - * Returns whether the given build job should be performed by this build service. - */ - default boolean builds(BuildJob buildJob) { return true; } - enum JobState { /** Job is not running, and may be triggered. */ @@ -42,8 +37,6 @@ public interface BuildService { } - // TODO jvenstad: Argh, refactor this, considering the new JobId, etc.. - // TODO jvenstad: Probably: make jobName JobType instead. class BuildJob { private final ApplicationId applicationId; diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/github/GitHubMock.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/github/GitHubMock.java index 9825887dcf5..9a398ef7cb5 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/github/GitHubMock.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/github/GitHubMock.java @@ -8,7 +8,7 @@ import java.util.Map; import java.util.UUID; /** - * @author jonmv + * @author jvenstad */ public class GitHubMock implements GitHub { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/DeploymentIssues.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/DeploymentIssues.java index 6888e8ac06d..fdebcca6d83 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/DeploymentIssues.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/DeploymentIssues.java @@ -12,7 +12,7 @@ import java.util.Optional; /** * Represents the people responsible for keeping Vespa up and running in a given organization, etc.. * - * @author jonmv + * @author jvenstad */ public interface DeploymentIssues { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/Issue.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/Issue.java index a9bc7868f7a..086487b8be7 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/Issue.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/Issue.java @@ -14,7 +14,7 @@ import java.util.Optional; * Represents an issue which needs to reported, typically from the controller, to a responsible party, * the identity of which is determined by the propertyId and, possibly, assignee fields. * - * @author jonmv + * @author jvenstad */ public class Issue { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueId.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueId.java index ccb65582d3c..84b441ff4a8 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueId.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueId.java @@ -7,7 +7,7 @@ import java.util.Objects; * Used to identify issues stored in some issue tracking system. * The {@code value()} and {@code from()} methods should be inverses. * - * @author jonmv + * @author jvenstad */ public class IssueId { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/Organization.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/Organization.java index 6dccaec3b7a..776002f31cb 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/Organization.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/Organization.java @@ -12,7 +12,7 @@ import java.util.Optional; * Represents the humans who use this software, and their organization. * Lets the software report issues to its caretakers, and provides other useful human resource lookups. * - * @author jonmv + * @author jvenstad */ public interface Organization { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/OwnershipIssues.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/OwnershipIssues.java index ee17859c0fb..91b5eb89c38 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/OwnershipIssues.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/OwnershipIssues.java @@ -14,7 +14,7 @@ import java.util.Optional; * with reassurance that any misbehaving applications will swiftly be dealt with. * Ignored confirmation requests are periodically redirected to humans of higher rank, until they are acknowledged. * - * @author jonmv + * @author jvenstad */ public interface OwnershipIssues { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/User.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/User.java index a88a9432c89..82a86de3824 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/User.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/User.java @@ -6,7 +6,7 @@ import java.util.Objects; /** * Represents a human computer user, typically by UNIX account name. * - * @author jonmv + * @author jvenstad */ public class User { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/LoggingDeploymentIssues.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/LoggingDeploymentIssues.java index c5efffd979a..b169194fd40 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/LoggingDeploymentIssues.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/LoggingDeploymentIssues.java @@ -26,7 +26,7 @@ import java.util.logging.Logger; * A memory backed implementation of the Issues API which logs changes and does nothing else. * * @author bratseth - * @author jonmv + * @author jvenstad */ public class LoggingDeploymentIssues implements DeploymentIssues { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockBuildService.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockBuildService.java index 2a8b06888b0..a8320f56fff 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockBuildService.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockBuildService.java @@ -13,7 +13,7 @@ import static com.yahoo.vespa.hosted.controller.api.integration.BuildService.Job import static com.yahoo.vespa.hosted.controller.api.integration.BuildService.JobState.running; /** - * @author jonmv + * @author jvenstad */ public class MockBuildService extends AbstractComponent implements BuildService { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneFilter.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneFilter.java index 3bcd7298a15..1cb5cd22b8d 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneFilter.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneFilter.java @@ -7,7 +7,7 @@ package com.yahoo.vespa.hosted.controller.api.integration.zone; * The methods here return instances of {@link ZoneList}, which extends ZoneFilter, but with accessors and additional filters. * This forces the developer to consider which of the filters in this class to apply, prior to processing any zones. * - * @author jonmv + * @author jvenstad */ public interface ZoneFilter { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneFilterMock.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneFilterMock.java index 67d2fd14e6b..7f4637e0492 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneFilterMock.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneFilterMock.java @@ -15,7 +15,7 @@ import java.util.stream.Collectors; /** * A Zones.List implementation which assumes all zones are controllerManaged. * - * @author jonmv + * @author jvenstad */ public class ZoneFilterMock implements ZoneList { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneId.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneId.java index b53b81398c6..21ac7a654b8 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneId.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneId.java @@ -11,7 +11,7 @@ import java.util.Objects; * * Serialised form is 'environment.region'. * - * @author jonmv + * @author jvenstad */ public class ZoneId { // TODO: Replace usages of environment + region with usages of this. diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneList.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneList.java index 4205f30e995..27e8a598043 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneList.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneList.java @@ -12,7 +12,7 @@ import java.util.List; * This is typically offered after an initial filter from {@link ZoneFilter} has been applied. * This forces the developer to consider which zones to process. * - * @author jonmv + * @author jvenstad */ public interface ZoneList extends ZoneFilter { 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; diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java index 621eb33bd66..225516644eb 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java @@ -26,7 +26,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.JobError; -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.SourceRevision; import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder; @@ -55,12 +55,12 @@ import java.util.stream.Collectors; import static com.yahoo.config.provision.SystemName.main; import static com.yahoo.vespa.hosted.controller.ControllerTester.buildJob; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.component; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionCorpUsEast1; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsEast3; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1; -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.productionCorpUsEast1; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.productionUsEast3; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.productionUsWest1; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; 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 d3b70ea07d8..cf2fa182d0a 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 @@ -16,7 +16,6 @@ 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.chef.ChefMock; import com.yahoo.vespa.hosted.controller.api.integration.deployment.ArtifactRepository; -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.entity.EntityService; import com.yahoo.vespa.hosted.controller.api.integration.entity.MemoryEntityService; @@ -26,6 +25,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.routing.MemoryGlobalRou import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockBuildService; 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.DeploymentJobs; import com.yahoo.vespa.hosted.controller.athenz.mock.AthenzClientFactoryMock; import com.yahoo.vespa.hosted.controller.athenz.mock.AthenzDbMock; import com.yahoo.vespa.hosted.controller.integration.MockMetricsService; @@ -122,7 +122,7 @@ public final class ControllerTester { }); } - public static BuildService.BuildJob buildJob(Application application, JobType jobType) { + public static BuildService.BuildJob buildJob(Application application, DeploymentJobs.JobType jobType) { return BuildService.BuildJob.of(application.id(), application.deploymentJobs().projectId().getAsLong(), jobType.jobName()); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/BuildJob.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/BuildJob.java index bec909addec..821eb237530 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/BuildJob.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/BuildJob.java @@ -4,7 +4,6 @@ package com.yahoo.vespa.hosted.controller.deployment; import com.yahoo.config.provision.ApplicationId; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.ArtifactRepositoryMock; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; import com.yahoo.vespa.hosted.controller.application.SourceRevision; @@ -25,7 +24,7 @@ public class BuildJob { "master", "commit1"); public static final long defaultBuildNumber = 42; - private JobType job; + private DeploymentJobs.JobType job; private ApplicationId applicationId; private Optional<DeploymentJobs.JobError> jobError = Optional.empty(); private Optional<SourceRevision> sourceRevision = Optional.of(defaultSourceRevision); @@ -42,7 +41,7 @@ public class BuildJob { this.artifactRepository = artifactRepository; } - public BuildJob type(JobType job) { + public BuildJob type(DeploymentJobs.JobType job) { this.job = job; return this; } @@ -106,7 +105,7 @@ public class BuildJob { public BuildJob uploadArtifact(ApplicationPackage applicationPackage) { Objects.requireNonNull(job, "job cannot be null"); Objects.requireNonNull(applicationId, "applicationId cannot be null"); - if (job != JobType.component) { + if (job != DeploymentJobs.JobType.component) { throw new IllegalStateException(job + " cannot upload artifact"); } artifactRepository.put(applicationId, applicationPackage, applicationVersion()); @@ -115,7 +114,7 @@ public class BuildJob { /** Send report for this build job to the controller */ public void submit() { - if (job == JobType.component && + if (job == DeploymentJobs.JobType.component && !artifactRepository.contains(applicationId, applicationVersion())) { throw new IllegalStateException(job + " must upload artifact before reporting completion"); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java index bae1f667566..f91dce2b203 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java @@ -17,7 +17,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.Change; 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.SystemApplication; import com.yahoo.vespa.hosted.controller.maintenance.JobControl; import com.yahoo.vespa.hosted.controller.maintenance.ReadyJobsTrigger; 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 033fddf3af8..10f53f17153 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 @@ -12,7 +12,8 @@ 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.Change; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; +import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; +import com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType; import com.yahoo.vespa.hosted.controller.application.SourceRevision; import com.yahoo.vespa.hosted.controller.maintenance.JobControl; import com.yahoo.vespa.hosted.controller.maintenance.ReadyJobsTrigger; @@ -25,13 +26,13 @@ import java.util.function.Supplier; import static com.yahoo.config.provision.SystemName.main; import static com.yahoo.vespa.hosted.controller.ControllerTester.buildJob; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.component; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionEuWest1; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsCentral1; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsEast3; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1; -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.productionEuWest1; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.productionUsCentral1; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.productionUsEast3; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.productionUsWest1; +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.singletonList; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -41,7 +42,7 @@ import static org.junit.Assert.assertTrue; /** * @author bratseth * @author mpolden - * @author jonmv + * @author jvenstad */ public class DeploymentTriggerTest { @@ -60,8 +61,8 @@ public class DeploymentTriggerTest { // Deploy completely once tester.jobCompletion(component).application(app).uploadArtifact(applicationPackage).submit(); - tester.deployAndNotify(app, applicationPackage, true, JobType.systemTest); - tester.deployAndNotify(app, applicationPackage, true, JobType.stagingTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.systemTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest); tester.deployAndNotify(app, applicationPackage, true, JobType.productionUsWest1); // New version is released @@ -228,17 +229,17 @@ public class DeploymentTriggerTest { tester.jobCompletion(component).application(app).uploadArtifact(applicationPackage).submit(); // Test environments pass - tester.deployAndNotify(app, applicationPackage, true, JobType.systemTest); - tester.deployAndNotify(app, applicationPackage, true, JobType.stagingTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.systemTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest); // Last declared job completes first - tester.deploy(JobType.productionUsWest1, app, applicationPackage); - tester.jobCompletion(JobType.productionUsWest1).application(app).submit(); + tester.deploy(DeploymentJobs.JobType.productionUsWest1, app, applicationPackage); + tester.jobCompletion(DeploymentJobs.JobType.productionUsWest1).application(app).submit(); assertTrue("Change is present as not all jobs are complete", tester.applications().require(app.id()).change().isPresent()); // All jobs complete - tester.deploy(JobType.productionUsEast3, app, applicationPackage); + tester.deploy(DeploymentJobs.JobType.productionUsEast3, app, applicationPackage); tester.jobCompletion(JobType.productionUsEast3).application(app).submit(); assertFalse("Change has been deployed", tester.applications().require(app.id()).change().isPresent()); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java index 703d65c8f9d..b5941c441e2 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java @@ -23,7 +23,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** - * @author jonmv + * @author jvenstad */ public class ApplicationOwnershipConfirmerTest { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java index a1aef28bd63..2abd01927a1 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java @@ -19,10 +19,10 @@ import java.time.Duration; import java.util.HashMap; import java.util.Map; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.component; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionCorpUsEast1; -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.productionCorpUsEast1; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest; import static com.yahoo.vespa.hosted.controller.maintenance.DeploymentIssueReporter.maxFailureAge; import static com.yahoo.vespa.hosted.controller.maintenance.DeploymentIssueReporter.maxInactivity; import static com.yahoo.vespa.hosted.controller.maintenance.DeploymentIssueReporter.upgradeGracePeriod; @@ -31,7 +31,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** - * @author jonmv + * @author jvenstad */ public class DeploymentIssueReporterTest { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DnsMaintainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DnsMaintainerTest.java index 1bedb29ec97..af7325950e4 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DnsMaintainerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DnsMaintainerTest.java @@ -18,8 +18,8 @@ import org.junit.Test; import java.time.Duration; import java.util.Optional; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.component; -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.systemTest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployerTest.java index 307007e394a..981b8c8c52a 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployerTest.java @@ -8,8 +8,8 @@ import com.yahoo.slime.Slime; import com.yahoo.vespa.config.SlimeUtils; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.ControllerTester; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; +import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder; import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester; import org.junit.Test; @@ -19,9 +19,9 @@ import java.nio.file.Paths; import java.time.Duration; import java.util.Collections; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.component; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsEast3; -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.productionUsEast3; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -44,9 +44,9 @@ public class FailureRedeployerTest { Application app = tester.createApplication("app1", "tenant1", 1, 11L); tester.jobCompletion(component).application(app).uploadArtifact(applicationPackage).submit(); - tester.deployAndNotify(app, applicationPackage, true, JobType.systemTest); - tester.deployAndNotify(app, applicationPackage, true, JobType.stagingTest); - tester.deployAndNotify(app, applicationPackage, true, JobType.productionUsEast3); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.systemTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.productionUsEast3); // New version is released version = Version.fromString("5.1"); @@ -56,12 +56,12 @@ public class FailureRedeployerTest { tester.readyJobTrigger().maintain(); // Test environments pass - tester.deployAndNotify(app, applicationPackage, true, JobType.systemTest); - tester.deployAndNotify(app, applicationPackage, true, JobType.stagingTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.systemTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest); // Production job fails and is retried tester.clock().advance(Duration.ofSeconds(1)); // Advance time so that we can detect jobs in progress - tester.deployAndNotify(app, applicationPackage, false, JobType.productionUsEast3); + tester.deployAndNotify(app, applicationPackage, false, DeploymentJobs.JobType.productionUsEast3); assertEquals("Production job is retried", 1, tester.buildService().jobs().size()); assertEquals("Application has pending upgrade to " + version, version, tester.application(app.id()).change().platform().get()); @@ -69,24 +69,24 @@ public class FailureRedeployerTest { version = Version.fromString("5.2"); tester.upgradeSystem(version); tester.upgrader().maintain(); - tester.jobCompletion(JobType.productionUsEast3).application(app).unsuccessful().submit(); + tester.jobCompletion(DeploymentJobs.JobType.productionUsEast3).application(app).unsuccessful().submit(); assertEquals("Application starts upgrading to new version", 2, tester.buildService().jobs().size()); assertEquals("Application has pending upgrade to " + version, version, tester.application(app.id()).change().platform().get()); // Failure re-deployer did not retry failing job for prod.us-east-3, since it no longer had an available change assertFalse("Job is not retried", tester.buildService().jobs().stream() - .anyMatch(j -> j.jobName().equals(JobType.productionUsEast3.jobName()))); + .anyMatch(j -> j.jobName().equals(DeploymentJobs.JobType.productionUsEast3.jobName()))); // Test environments pass - tester.deployAndNotify(app, applicationPackage, true, JobType.systemTest); - tester.deployAndNotify(app, applicationPackage, true, JobType.stagingTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.systemTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest); // Production job fails again, and is retried - tester.deployAndNotify(app, applicationPackage, false, JobType.productionUsEast3); + tester.deployAndNotify(app, applicationPackage, false, DeploymentJobs.JobType.productionUsEast3); assertEquals("Job is retried", Collections.singletonList(ControllerTester.buildJob(app, productionUsEast3)), tester.buildService().jobs()); // Production job finally succeeds - tester.deployAndNotify(app, applicationPackage, true, JobType.productionUsEast3); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.productionUsEast3); assertTrue("All jobs consumed", tester.buildService().jobs().isEmpty()); assertFalse("No failures", tester.application(app.id()).deploymentJobs().hasFailures()); } @@ -103,9 +103,9 @@ public class FailureRedeployerTest { Application app = tester.createApplication("app1", "tenant1", 1, 11L); tester.jobCompletion(component).application(app).uploadArtifact(applicationPackage).submit(); - tester.deployAndNotify(app, applicationPackage, true, JobType.systemTest); - tester.deployAndNotify(app, applicationPackage, true, JobType.stagingTest); - tester.deployAndNotify(app, applicationPackage, true, JobType.productionUsEast3); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.systemTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.productionUsEast3); // New version is released version = Version.fromString("5.1"); @@ -116,7 +116,7 @@ public class FailureRedeployerTest { assertEquals("Application has pending upgrade to " + version, version, tester.application(app.id()).change().platform().get()); // system-test fails and is left with a retry - tester.deployAndNotify(app, applicationPackage, false, JobType.systemTest); + tester.deployAndNotify(app, applicationPackage, false, DeploymentJobs.JobType.systemTest); // Another version is released version = Version.fromString("5.2"); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java index e189a9243db..af61af6da52 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java @@ -31,10 +31,10 @@ import java.time.Instant; import java.time.ZoneId; import java.util.Map; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.component; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1; -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.productionUsWest1; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java index 4483122d554..3b14ad4bf10 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java @@ -5,9 +5,9 @@ import com.yahoo.component.Version; import com.yahoo.config.provision.Environment; import com.yahoo.vespa.hosted.controller.Application; 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.ApplicationPackage; import com.yahoo.vespa.hosted.controller.application.Change; +import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; import com.yahoo.vespa.hosted.controller.application.SourceRevision; import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder; import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester; @@ -46,7 +46,7 @@ public class OutstandingChangeDeployerTest { assertEquals(Change.of(version), tester.application("app1").change()); assertFalse(tester.application("app1").outstandingChange().isPresent()); - tester.jobCompletion(JobType.component) + tester.jobCompletion(DeploymentJobs.JobType.component) .application(tester.application("app1")) .sourceRevision(new SourceRevision("repository1","master", "cafed00d")) .nextBuildNumber() @@ -63,9 +63,9 @@ public class OutstandingChangeDeployerTest { assertEquals("No effect as job is in progress", 2, tester.buildService().jobs().size()); assertEquals("1.0.43-cafed00d", app.outstandingChange().application().get().id()); - tester.deployAndNotify(app, applicationPackage, true, JobType.systemTest); - tester.deployAndNotify(app, applicationPackage, true, JobType.stagingTest); - tester.deployAndNotify(app, applicationPackage, true, JobType.productionUsWest1); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.systemTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest); + tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.productionUsWest1); assertEquals("Upgrade done", 0, tester.buildService().jobs().size()); deployer.maintain(); @@ -75,8 +75,8 @@ public class OutstandingChangeDeployerTest { List<BuildService.BuildJob> jobs = tester.buildService().jobs(); assertEquals(2, jobs.size()); assertEquals(11, jobs.get(0).projectId()); - tester.assertRunning(JobType.systemTest, app.id()); - tester.assertRunning(JobType.stagingTest, app.id()); + tester.assertRunning(DeploymentJobs.JobType.systemTest, app.id()); + tester.assertRunning(DeploymentJobs.JobType.stagingTest, app.id()); assertFalse(tester.application("app1").outstandingChange().isPresent()); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java index 781933eda64..cf32a18522f 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java @@ -7,10 +7,10 @@ import com.yahoo.config.provision.RegionName; import com.yahoo.test.ManualClock; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.ControllerTester; -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.ApplicationPackage; import com.yahoo.vespa.hosted.controller.application.Deployment; +import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder; import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester; import com.yahoo.vespa.hosted.controller.versions.VespaVersion; @@ -19,12 +19,12 @@ import org.junit.Test; import java.time.Duration; import java.time.Instant; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.component; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsCentral1; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsEast3; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1; -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.productionUsCentral1; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.productionUsEast3; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.productionUsWest1; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -220,7 +220,7 @@ public class UpgraderTest { tester.completeUpgradeWithError(default3, version54, "default", stagingTest); - tester.completeUpgradeWithError(default4, version54, "default", JobType.productionUsWest1); + tester.completeUpgradeWithError(default4, version54, "default", DeploymentJobs.JobType.productionUsWest1); // State: Default applications started upgrading to 5.5 tester.clock().advance(Duration.ofHours(1)); tester.upgrader().maintain(); @@ -231,13 +231,13 @@ public class UpgraderTest { tester.completeUpgradeWithError(default2, version55, "default", stagingTest); tester.clock().advance(Duration.ofHours(2).plus(Duration.ofSeconds(1))); // Retry failing job for default3 tester.readyJobTrigger().maintain(); - tester.completeUpgradeWithError(default3, version55, "default", JobType.productionUsWest1); + tester.completeUpgradeWithError(default3, version55, "default", DeploymentJobs.JobType.productionUsWest1); tester.upgradeSystem(version55); assertEquals(VespaVersion.Confidence.broken, tester.controller().versionStatus().systemVersion().get().confidence()); // Finish running job, without retry. tester.clock().advance(Duration.ofHours(1)); - tester.jobCompletion(JobType.productionUsWest1).application(default3).unsuccessful().submit(); + tester.jobCompletion(DeploymentJobs.JobType.productionUsWest1).application(default3).unsuccessful().submit(); tester.upgrader().maintain(); tester.buildService().clear(); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java index 95a785ca0df..656c377b84b 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java @@ -10,7 +10,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; -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; @@ -79,13 +78,13 @@ public class ApplicationSerializerTest { OptionalLong projectId = OptionalLong.of(123L); List<JobStatus> statusList = new ArrayList<>(); - statusList.add(JobStatus.initial(JobType.systemTest) + statusList.add(JobStatus.initial(DeploymentJobs.JobType.systemTest) .withTriggering(Version.fromString("5.6.7"), ApplicationVersion.unknown, empty(), "Test", Instant.ofEpochMilli(7)) .withCompletion(30, empty(), Instant.ofEpochMilli(8))); - statusList.add(JobStatus.initial(JobType.stagingTest) + statusList.add(JobStatus.initial(DeploymentJobs.JobType.stagingTest) .withTriggering(Version.fromString("5.6.6"), ApplicationVersion.unknown, empty(), "Test 2", Instant.ofEpochMilli(5)) .withCompletion(11, Optional.of(JobError.unknown), Instant.ofEpochMilli(6))); - statusList.add(JobStatus.initial(JobType.from(main, zone1).get()) + statusList.add(JobStatus.initial(DeploymentJobs.JobType.from(main, zone1).get()) .withTriggering(Version.fromString("5.6.6"), ApplicationVersion.unknown, deployments.stream().findFirst(), "Test 3", Instant.ofEpochMilli(6)) .withCompletion(11, empty(), Instant.ofEpochMilli(7))); @@ -120,10 +119,10 @@ public class ApplicationSerializerTest { assertEquals(original.deploymentJobs().projectId(), serialized.deploymentJobs().projectId()); assertEquals(original.deploymentJobs().jobStatus().size(), serialized.deploymentJobs().jobStatus().size()); - assertEquals( original.deploymentJobs().jobStatus().get(JobType.systemTest), - serialized.deploymentJobs().jobStatus().get(JobType.systemTest)); - assertEquals( original.deploymentJobs().jobStatus().get(JobType.stagingTest), - serialized.deploymentJobs().jobStatus().get(JobType.stagingTest)); + assertEquals( original.deploymentJobs().jobStatus().get(DeploymentJobs.JobType.systemTest), + serialized.deploymentJobs().jobStatus().get(DeploymentJobs.JobType.systemTest)); + assertEquals( original.deploymentJobs().jobStatus().get(DeploymentJobs.JobType.stagingTest), + serialized.deploymentJobs().jobStatus().get(DeploymentJobs.JobType.stagingTest)); assertEquals(original.outstandingChange(), serialized.outstandingChange()); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java index 6d88cf79241..51437be2832 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java @@ -12,12 +12,14 @@ import com.yahoo.vespa.hosted.controller.ArtifactRepositoryMock; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.TestIdentities; import com.yahoo.vespa.hosted.controller.api.application.v4.model.DeployOptions; +import com.yahoo.vespa.hosted.controller.api.identifiers.GitBranch; +import com.yahoo.vespa.hosted.controller.api.identifiers.GitCommit; +import com.yahoo.vespa.hosted.controller.api.identifiers.GitRepository; 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.identifiers.ScrewdriverId; import com.yahoo.vespa.hosted.controller.api.integration.athenz.ApplicationAction; import com.yahoo.vespa.hosted.controller.api.integration.athenz.HostedAthenzIdentities; -import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockBuildService; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; @@ -36,7 +38,7 @@ import java.io.IOException; import java.time.Duration; import java.util.Optional; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.component; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.component; import static org.junit.Assert.assertFalse; /** @@ -90,7 +92,7 @@ public class ContainerControllerTester { } /** Notify the controller about a job completing */ - public BuildJob jobCompletion(JobType job) { + public BuildJob jobCompletion(DeploymentJobs.JobType job) { return new BuildJob(this::notifyJobCompletion, artifactRepository()).type(job); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java index c748d32ef0b..545ee529635 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java @@ -27,7 +27,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.MetricsService.Applicat import com.yahoo.vespa.hosted.controller.api.integration.athenz.ApplicationAction; import com.yahoo.vespa.hosted.controller.api.integration.athenz.HostedAthenzIdentities; import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerException; -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.organization.MockOrganization; import com.yahoo.vespa.hosted.controller.api.integration.organization.User; @@ -195,7 +194,7 @@ public class ApplicationApiTest extends ControllerContainerTest { new com.yahoo.vespa.hosted.controller.api.identifiers.ApplicationId(id.application().value())); // (Necessary but not provided in this API) // Trigger deployment from completion of component job - controllerTester.jobCompletion(JobType.component) + controllerTester.jobCompletion(DeploymentJobs.JobType.component) .application(id) .projectId(screwdriverProjectId) .uploadArtifact(applicationPackage) @@ -210,7 +209,7 @@ public class ApplicationApiTest extends ControllerContainerTest { .screwdriverIdentity(SCREWDRIVER_ID), "Deactivated tenant/tenant1/application/application1/environment/test/region/us-east-1/instance/default"); // Called through the separate screwdriver/v1 API - controllerTester.jobCompletion(JobType.systemTest) + controllerTester.jobCompletion(DeploymentJobs.JobType.systemTest) .application(id) .projectId(screwdriverProjectId) .submit(); @@ -223,7 +222,7 @@ public class ApplicationApiTest extends ControllerContainerTest { tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/environment/staging/region/us-east-3/instance/default", DELETE) .screwdriverIdentity(SCREWDRIVER_ID), "Deactivated tenant/tenant1/application/application1/environment/staging/region/us-east-3/instance/default"); - controllerTester.jobCompletion(JobType.stagingTest) + controllerTester.jobCompletion(DeploymentJobs.JobType.stagingTest) .application(id) .projectId(screwdriverProjectId) .submit(); @@ -233,7 +232,7 @@ public class ApplicationApiTest extends ControllerContainerTest { .data(createApplicationDeployData(applicationPackage, false)) .screwdriverIdentity(SCREWDRIVER_ID), new File("deploy-result.json")); - controllerTester.jobCompletion(JobType.productionCorpUsEast1) + controllerTester.jobCompletion(DeploymentJobs.JobType.productionCorpUsEast1) .application(id) .projectId(screwdriverProjectId) .unsuccessful() @@ -493,7 +492,7 @@ public class ApplicationApiTest extends ControllerContainerTest { .data(deployData) .screwdriverIdentity(SCREWDRIVER_ID), new File("deploy-result.json")); - controllerTester.jobCompletion(JobType.productionUsEast3) + controllerTester.jobCompletion(DeploymentJobs.JobType.productionUsEast3) .application(id) .projectId(projectId) .submit(); @@ -512,7 +511,7 @@ public class ApplicationApiTest extends ControllerContainerTest { .data(deployData) .screwdriverIdentity(SCREWDRIVER_ID), new File("deploy-result.json")); - controllerTester.jobCompletion(JobType.productionUsWest1) + controllerTester.jobCompletion(DeploymentJobs.JobType.productionUsWest1) .application(id) .projectId(projectId) .submit(); @@ -522,7 +521,7 @@ public class ApplicationApiTest extends ControllerContainerTest { .data(deployData) .screwdriverIdentity(SCREWDRIVER_ID), new File("deploy-result.json")); - controllerTester.jobCompletion(JobType.productionUsEast3) + controllerTester.jobCompletion(DeploymentJobs.JobType.productionUsEast3) .application(id) .projectId(projectId) .submit(); @@ -831,7 +830,7 @@ public class ApplicationApiTest extends ControllerContainerTest { controllerTester.authorize(ATHENZ_TENANT_DOMAIN, screwdriverId, ApplicationAction.deploy, application); // Allow systemtest to succeed by notifying completion of system test - controllerTester.jobCompletion(JobType.component) + controllerTester.jobCompletion(DeploymentJobs.JobType.component) .application(application.id()) .projectId(screwdriverProjectId) .uploadArtifact(applicationPackage) @@ -860,27 +859,27 @@ public class ApplicationApiTest extends ControllerContainerTest { BuildJob job = new BuildJob(report -> notifyCompletion(report, tester), tester.artifactRepository()) .application(app) .projectId(projectId); - job.type(JobType.component).uploadArtifact(applicationPackage).submit(); + job.type(DeploymentJobs.JobType.component).uploadArtifact(applicationPackage).submit(); tester.deploy(app, applicationPackage, TEST_ZONE, projectId); - job.type(JobType.systemTest).submit(); + job.type(DeploymentJobs.JobType.systemTest).submit(); // Notifying about unknown job fails Request request = request("/application/v4/tenant/tenant1/application/application1/jobreport", POST) - .data(asJson(job.type(JobType.productionUsEast3).report())) + .data(asJson(job.type(DeploymentJobs.JobType.productionUsEast3).report())) .userIdentity(HOSTED_VESPA_OPERATOR) .get(); tester.containerTester().assertResponse(request, new File("jobreport-unexpected-completion.json"), 400); // ... and assert it was recorded JobStatus recordedStatus = - tester.controller().applications().get(app.id()).get().deploymentJobs().jobStatus().get(JobType.component); + tester.controller().applications().get(app.id()).get().deploymentJobs().jobStatus().get(DeploymentJobs.JobType.component); assertNotNull("Status was recorded", recordedStatus); assertTrue(recordedStatus.isSuccess()); assertEquals(vespaVersion, recordedStatus.lastCompleted().get().platform()); recordedStatus = - tester.controller().applications().get(app.id()).get().deploymentJobs().jobStatus().get(JobType.productionApNortheast2); + tester.controller().applications().get(app.id()).get().deploymentJobs().jobStatus().get(DeploymentJobs.JobType.productionApNortheast2); assertNull("Status of never-triggered jobs is empty", recordedStatus); Response response; @@ -907,19 +906,19 @@ public class ApplicationApiTest extends ControllerContainerTest { BuildJob job = new BuildJob(report -> notifyCompletion(report, tester), tester.artifactRepository()) .application(app) .projectId(projectId); - job.type(JobType.component).uploadArtifact(applicationPackage).submit(); + job.type(DeploymentJobs.JobType.component).uploadArtifact(applicationPackage).submit(); tester.deploy(app, applicationPackage, TEST_ZONE, projectId); - job.type(JobType.systemTest).submit(); + job.type(DeploymentJobs.JobType.systemTest).submit(); tester.deploy(app, applicationPackage, STAGING_ZONE, projectId); - job.type(JobType.stagingTest).error(DeploymentJobs.JobError.outOfCapacity).submit(); + job.type(DeploymentJobs.JobType.stagingTest).error(DeploymentJobs.JobError.outOfCapacity).submit(); // Appropriate error is recorded JobStatus jobStatus = tester.controller().applications().get(app.id()) .get() .deploymentJobs() .jobStatus() - .get(JobType.stagingTest); + .get(DeploymentJobs.JobType.stagingTest); assertFalse(jobStatus.isSuccess()); assertEquals(DeploymentJobs.JobError.outOfCapacity, jobStatus.jobError().get()); } @@ -1063,7 +1062,7 @@ public class ApplicationApiTest extends ControllerContainerTest { // Trigger application change controllerTester.artifactRepository().put(application, applicationPackage,"1.0." + buildNumber + "-commit1"); - controllerTester.jobCompletion(JobType.component) + controllerTester.jobCompletion(DeploymentJobs.JobType.component) .application(application) .projectId(projectId) .buildNumber(buildNumber) @@ -1079,7 +1078,7 @@ public class ApplicationApiTest extends ControllerContainerTest { tester.assertResponse(request(testPath, DELETE) .screwdriverIdentity(SCREWDRIVER_ID), "Deactivated " + testPath.replaceFirst("/application/v4/", "")); - controllerTester.jobCompletion(JobType.systemTest) + controllerTester.jobCompletion(DeploymentJobs.JobType.systemTest) .application(application) .projectId(projectId) .submit(); @@ -1094,7 +1093,7 @@ public class ApplicationApiTest extends ControllerContainerTest { tester.assertResponse(request(stagingPath, DELETE) .screwdriverIdentity(SCREWDRIVER_ID), "Deactivated " + stagingPath.replaceFirst("/application/v4/", "")); - controllerTester.jobCompletion(JobType.stagingTest) + controllerTester.jobCompletion(DeploymentJobs.JobType.stagingTest) .application(application) .projectId(projectId) .submit(); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java index 61f915f3c1e..fa93c0f1df1 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java @@ -8,9 +8,9 @@ import com.yahoo.config.provision.HostName; import com.yahoo.config.provision.RegionName; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.Controller; -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.ApplicationPackage; +import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder; import com.yahoo.vespa.hosted.controller.restapi.ContainerControllerTester; import com.yahoo.vespa.hosted.controller.restapi.ControllerContainerTest; @@ -102,20 +102,20 @@ public class DeploymentApiTest extends ControllerContainerTest { private void deployCompletely(Application application, ApplicationPackage applicationPackage, long projectId, boolean success) { - tester.jobCompletion(JobType.component) + tester.jobCompletion(DeploymentJobs.JobType.component) .application(application) .projectId(projectId) .uploadArtifact(applicationPackage) .submit(); tester.deploy(application, applicationPackage, ZoneId.from(Environment.test, RegionName.from("us-east-1")), projectId); - tester.jobCompletion(JobType.systemTest) + tester.jobCompletion(DeploymentJobs.JobType.systemTest) .application(application) .projectId(projectId) .submit(); tester.deploy(application, applicationPackage, ZoneId.from(Environment.staging, RegionName.from("us-east-3")), projectId); - tester.jobCompletion(JobType.stagingTest) + tester.jobCompletion(DeploymentJobs.JobType.stagingTest) .application(application) .projectId(projectId) .success(success) @@ -123,7 +123,7 @@ public class DeploymentApiTest extends ControllerContainerTest { if (success) { tester.deploy(application, applicationPackage, ZoneId.from(Environment.prod, RegionName.from("corp-us-east-1")), projectId); - tester.jobCompletion(JobType.productionCorpUsEast1) + tester.jobCompletion(DeploymentJobs.JobType.productionCorpUsEast1) .application(application) .projectId(projectId) .submit(); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java index 6cd4464dce4..99274fd9f44 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java @@ -3,7 +3,7 @@ package com.yahoo.vespa.hosted.controller.restapi.screwdriver; import com.yahoo.application.container.handler.Request; 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; import com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobReport; import com.yahoo.vespa.hosted.controller.application.SourceRevision; import com.yahoo.vespa.hosted.controller.restapi.ContainerControllerTester; @@ -18,7 +18,7 @@ import java.util.OptionalLong; /** * @author bratseth - * @author jonmv + * @author jvenstad */ public class ScrewdriverApiTest extends ControllerContainerTest { @@ -62,7 +62,7 @@ public class ScrewdriverApiTest extends ControllerContainerTest { new byte[0], Request.Method.POST, () -> "user"), 200, "{\"message\":\"Triggered component for tenant1.application1\"}"); tester.controller().applications().deploymentTrigger().notifyOfCompletion(new JobReport(app.id(), - JobType.component, + DeploymentJobs.JobType.component, 1, 42, Optional.of(new SourceRevision("repo", "branch", "commit")), diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/versions/VersionStatusTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/versions/VersionStatusTest.java index 09216eec3c7..57676ffc3f5 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/versions/VersionStatusTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/versions/VersionStatusTest.java @@ -24,10 +24,10 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsEast3; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1; -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.productionUsEast3; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.productionUsWest1; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest; +import static com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/Template.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/Template.java index 14fea240baa..6092cc1f038 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/Template.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/Template.java @@ -13,7 +13,7 @@ import java.nio.file.Path; * Uses the Velocity engine to render a template, to and from both String and Path objects. * * @author hakonhall - * @author jonmv + * @author jvenstad */ public class Template { |