diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2019-12-05 13:35:02 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2019-12-11 10:49:29 +0100 |
commit | 9c3449d3a572b89bc4d010b3f24e3a93b2c556c9 (patch) | |
tree | c287f51cdca5696594bb640d45948b9b74e14d4e /controller-api | |
parent | c2eae30c17cae7a46c7ac07db8b69e454da809db (diff) |
First draft of deployment orchestration state graph
Diffstat (limited to 'controller-api')
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java index 8eb217f6d4b..4bbc65eee9f 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java @@ -100,13 +100,19 @@ public enum JobType { private final String jobName; private final Map<SystemName, ZoneId> zones; + private final boolean isTest; - JobType(String jobName, Map<SystemName, ZoneId> zones) { + JobType(String jobName, Map<SystemName, ZoneId> zones, boolean isTest) { if (zones.values().stream().map(ZoneId::environment).distinct().count() > 1) throw new IllegalArgumentException("All zones of a job must be in the same environment"); this.jobName = jobName; this.zones = zones; + this.isTest = isTest; + } + + JobType(String jobName, Map<SystemName, ZoneId> zones) { + this(jobName, zones, false); } public String jobName() { return jobName; } @@ -126,8 +132,8 @@ public enum JobType { /** 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 whether this is a pure test step */ + public boolean isTest() { return isTest; } /** Returns the environment of this job type, or null if it does not have an environment */ public Environment environment() { @@ -146,12 +152,22 @@ public enum JobType { } /** Returns the job type for the given zone */ - public static Optional<JobType> from(SystemName system, ZoneId zone) { + public static Optional<JobType> from(SystemName system, ZoneId zone, boolean isTest) { return Stream.of(values()) - .filter(job -> zone.equals(job.zones.get(system))) + .filter(job -> zone.equals(job.zones.get(system)) && job.isTest() == isTest) .findAny(); } + /** Returns the job type for the given zone */ + public static Optional<JobType> from(SystemName system, ZoneId zone) { + return from(system, zone, false); + } + + /** Returns the production test job type for the given environment and region or null if none */ + public static Optional<JobType> from(SystemName system, RegionName region) { + return from(system, ZoneId.from(Environment.prod, region), true); + } + /** 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) { |