From 1cede6bf2388dfa45a0aed947fded75f4164396e Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Tue, 7 Apr 2020 19:05:43 +0200 Subject: Provide all (relevant runs of all) jobs in deployment API --- .../restapi/deployment/DeploymentApiHandler.java | 91 +++-- .../restapi/deployment/responses/root.json | 414 ++++++++++++++++++++- 2 files changed, 478 insertions(+), 27 deletions(-) (limited to 'controller-server') diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java index 4f2092a590c..b1706e044bd 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java @@ -1,7 +1,6 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.restapi.deployment; -import com.yahoo.component.Version; import com.yahoo.component.Vtag; import com.yahoo.config.application.api.DeploymentInstanceSpec; import com.yahoo.config.application.api.DeploymentSpec; @@ -17,29 +16,24 @@ import com.yahoo.restapi.Uri; 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.deployment.JobType; import com.yahoo.vespa.hosted.controller.application.ApplicationList; import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId; -import com.yahoo.vespa.hosted.controller.deployment.DeploymentStatus; -import com.yahoo.vespa.hosted.controller.deployment.DeploymentStatusList; -import com.yahoo.vespa.hosted.controller.deployment.JobList; import com.yahoo.vespa.hosted.controller.deployment.Run; -import com.yahoo.vespa.hosted.controller.deployment.RunStatus; import com.yahoo.vespa.hosted.controller.restapi.application.EmptyResponse; import com.yahoo.vespa.hosted.controller.versions.DeploymentStatistics; import com.yahoo.vespa.hosted.controller.versions.VespaVersion; import com.yahoo.yolean.Exceptions; -import java.time.Instant; -import java.util.Comparator; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.function.Function; +import java.util.LinkedHashMap; +import java.util.List; import java.util.logging.Level; import java.util.stream.Collectors; +import java.util.stream.Stream; +import static java.util.function.Function.identity; import static java.util.stream.Collectors.groupingBy; -import static java.util.stream.Collectors.toUnmodifiableList; +import static java.util.stream.Collectors.toMap; import static java.util.stream.Collectors.toUnmodifiableMap; /** @@ -101,7 +95,7 @@ public class DeploymentApiHandler extends LoggingRequestHandler { var deploymentStatuses = controller.jobController().deploymentStatuses(ApplicationList.from(controller.applications().asList()), systemVersion); var deploymentStatistics = DeploymentStatistics.compute(versionStatus.versions().stream().map(VespaVersion::versionNumber).collect(Collectors.toList()), deploymentStatuses) - .stream().collect(Collectors.toMap(DeploymentStatistics::version, Function.identity())); + .stream().collect(toMap(DeploymentStatistics::version, identity())); for (VespaVersion version : versionStatus.versions()) { Cursor versionObject = platformArray.addObject(); versionObject.setString("version", version.versionNumber().toString()); @@ -117,8 +111,9 @@ public class DeploymentApiHandler extends LoggingRequestHandler { configServerObject.setString("hostname", hostname.value()); } + DeploymentStatistics statistics = deploymentStatistics.get(version.versionNumber()); Cursor failingArray = versionObject.setArray("failingApplications"); - for (Run run : deploymentStatistics.get(version.versionNumber()).failingUpgrades()) { + for (Run run : statistics.failingUpgrades()) { Cursor applicationObject = failingArray.addObject(); toSlime(applicationObject, run.id().application(), request); applicationObject.setString("failing", run.id().type().jobName()); @@ -129,25 +124,73 @@ public class DeploymentApiHandler extends LoggingRequestHandler { .flatMap(status -> status.instanceJobs().entrySet().stream()) .collect(toUnmodifiableMap(jobs -> jobs.getKey(), jobs -> jobs.getValue())); Cursor productionArray = versionObject.setArray("productionApplications"); - deploymentStatistics.get(version.versionNumber()).productionSuccesses().stream() - .collect(groupingBy(run -> run.id().application())) - .forEach((id, runs) -> { - Cursor applicationObject = productionArray.addObject(); - toSlime(applicationObject, id, request); - applicationObject.setLong("productionJobs", jobsByInstance.get(id).production().size()); - applicationObject.setLong("productionSuccesses", runs.size()); - }); + statistics.productionSuccesses().stream() + .collect(groupingBy(run -> run.id().application())) + .forEach((id, runs) -> { + Cursor applicationObject = productionArray.addObject(); + toSlime(applicationObject, id, request); + applicationObject.setLong("productionJobs", jobsByInstance.get(id).production().size()); + applicationObject.setLong("productionSuccesses", runs.size()); + }); Cursor runningArray = versionObject.setArray("deployingApplications"); - for (Run run : deploymentStatistics.get(version.versionNumber()).runningUpgrade()) { + for (Run run : statistics.runningUpgrade()) { Cursor applicationObject = runningArray.addObject(); toSlime(applicationObject, run.id().application(), request); applicationObject.setString("running", run.id().type().jobName()); } + + class RunInfo { // ヽ༼ຈل͜ຈ༽━☆゚.*・。゚ + final Run run; + final boolean upgrade; + RunInfo(Run run, boolean upgrade) { this.run = run; this.upgrade = upgrade; } + @Override public String toString() { return run.id().toString(); } + } + Cursor instancesArray = versionObject.setArray("applications"); + Stream.of(statistics.failingUpgrades().stream().map(run -> new RunInfo(run, true)), + statistics.otherFailing().stream().map(run -> new RunInfo(run, false)), + statistics.runningUpgrade().stream().map(run -> new RunInfo(run, true)), + statistics.otherRunning().stream().map(run -> new RunInfo(run, false)), + statistics.productionSuccesses().stream().map(run -> new RunInfo(run, true))) + .flatMap(identity()) + .collect(Collectors.groupingBy(run -> run.run.id().application(), + LinkedHashMap::new, // Put apps with failing and running jobs first. + groupingBy(run -> run.run.id().type()))) + .forEach((instance, runs) -> { + Cursor instanceObject = instancesArray.addObject(); + instanceObject.setString("tenant", instance.tenant().value()); + instanceObject.setString("application", instance.application().value()); + instanceObject.setString("instance", instance.instance().value()); + instanceObject.setLong("productionJobCount", jobsByInstance.get(instance).production().size()); + instanceObject.setString("upgradePolicy", toString(deploymentStatuses.matching(status -> status.application().id().equals(TenantAndApplicationId.from(instance))) + .first().map(status -> status.application().deploymentSpec()) + .flatMap(spec -> spec.instance(instance.instance()).map(DeploymentInstanceSpec::upgradePolicy)) + .orElse(DeploymentSpec.UpgradePolicy.defaultPolicy))); + Cursor allJobsObject = instanceObject.setObject("allJobs"); + Cursor upgradeJobsObject = instanceObject.setObject("upgradeJobs"); + for (JobType type : JobType.allIn(controller.system())) { + Cursor jobObject = allJobsObject.setObject(type.jobName()); + Cursor upgradeObject = upgradeJobsObject.setObject(type.jobName()); + for (RunInfo run : runs.getOrDefault(type, List.of())) { + toSlime(jobObject, run.run); + if (run.upgrade) + toSlime(upgradeObject, run.run); + } + } + }); } return new SlimeJsonResponse(slime); } + private void toSlime(Cursor jobObject, Run run) { + String key = run.hasFailed() ? "failing" : run.hasEnded() ? "success" : "running"; + Cursor runObject = jobObject.setObject(key); + runObject.setLong("number", run.id().number()); + runObject.setLong("start", run.start().toEpochMilli()); + run.end().ifPresent(end -> runObject.setLong("end", end.toEpochMilli())); + runObject.setString("status", run.status().name()); + } + private void toSlime(Cursor object, ApplicationId id, HttpRequest request) { object.setString("tenant", id.tenant().value()); object.setString("application", id.application().value()); @@ -168,6 +211,4 @@ public class DeploymentApiHandler extends LoggingRequestHandler { return upgradePolicy.name(); } - // ----------------------------- Utilities to pick out the relevant JobStatus -- filter chains should mirror the ones in VersionStatus - } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json index 50144b725e6..88c9c5030cf 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json @@ -29,7 +29,159 @@ "productionSuccesses": 1 } ], - "deployingApplications": [] + "deployingApplications": [], + "applications": [ + { + "tenant": "tenant1", + "application": "application1", + "instance": "default", + "productionJobCount": 1, + "upgradePolicy": "default", + "allJobs": { + "system-test": {}, + "staging-test": {}, + "production-us-east-3": {}, + "test-us-east-3": {}, + "production-us-west-1": { + "success": { + "number": 1, + "start": 1586278617924, + "end": 1586278617924, + "status": "success" + } + }, + "test-us-west-1": {}, + "production-us-central-1": {}, + "test-us-central-1": {}, + "production-ap-northeast-1": {}, + "test-ap-northeast-1": {}, + "production-ap-northeast-2": {}, + "test-ap-northeast-2": {}, + "production-ap-southeast-1": {}, + "test-ap-southeast-1": {}, + "production-eu-west-1": {}, + "test-eu-west-1": {}, + "production-aws-us-east-1a": {}, + "test-aws-us-east-1a": {}, + "production-aws-us-west-2a": {}, + "test-aws-us-west-2a": {}, + "production-aws-us-east-1b": {}, + "test-aws-us-east-1b": {}, + "dev-us-east-1": {}, + "dev-aws-us-east-2a": {}, + "perf-us-east-3": {} + }, + "upgradeJobs": { + "system-test": {}, + "staging-test": {}, + "production-us-east-3": {}, + "test-us-east-3": {}, + "production-us-west-1": { + "success": { + "number": 1, + "start": 1586278617924, + "end": 1586278617924, + "status": "success" + } + }, + "test-us-west-1": {}, + "production-us-central-1": {}, + "test-us-central-1": {}, + "production-ap-northeast-1": {}, + "test-ap-northeast-1": {}, + "production-ap-northeast-2": {}, + "test-ap-northeast-2": {}, + "production-ap-southeast-1": {}, + "test-ap-southeast-1": {}, + "production-eu-west-1": {}, + "test-eu-west-1": {}, + "production-aws-us-east-1a": {}, + "test-aws-us-east-1a": {}, + "production-aws-us-west-2a": {}, + "test-aws-us-west-2a": {}, + "production-aws-us-east-1b": {}, + "test-aws-us-east-1b": {}, + "dev-us-east-1": {}, + "dev-aws-us-east-2a": {}, + "perf-us-east-3": {} + } + }, + { + "tenant": "tenant2", + "application": "application2", + "instance": "i2", + "productionJobCount": 1, + "upgradePolicy": "default", + "allJobs": { + "system-test": {}, + "staging-test": {}, + "production-us-east-3": {}, + "test-us-east-3": {}, + "production-us-west-1": { + "success": { + "number": 1, + "start": 1586278617924, + "end": 1586278617924, + "status": "success" + } + }, + "test-us-west-1": {}, + "production-us-central-1": {}, + "test-us-central-1": {}, + "production-ap-northeast-1": {}, + "test-ap-northeast-1": {}, + "production-ap-northeast-2": {}, + "test-ap-northeast-2": {}, + "production-ap-southeast-1": {}, + "test-ap-southeast-1": {}, + "production-eu-west-1": {}, + "test-eu-west-1": {}, + "production-aws-us-east-1a": {}, + "test-aws-us-east-1a": {}, + "production-aws-us-west-2a": {}, + "test-aws-us-west-2a": {}, + "production-aws-us-east-1b": {}, + "test-aws-us-east-1b": {}, + "dev-us-east-1": {}, + "dev-aws-us-east-2a": {}, + "perf-us-east-3": {} + }, + "upgradeJobs": { + "system-test": {}, + "staging-test": {}, + "production-us-east-3": {}, + "test-us-east-3": {}, + "production-us-west-1": { + "success": { + "number": 1, + "start": 1586278617924, + "end": 1586278617924, + "status": "success" + } + }, + "test-us-west-1": {}, + "production-us-central-1": {}, + "test-us-central-1": {}, + "production-ap-northeast-1": {}, + "test-ap-northeast-1": {}, + "production-ap-northeast-2": {}, + "test-ap-northeast-2": {}, + "production-ap-southeast-1": {}, + "test-ap-southeast-1": {}, + "production-eu-west-1": {}, + "test-eu-west-1": {}, + "production-aws-us-east-1a": {}, + "test-aws-us-east-1a": {}, + "production-aws-us-west-2a": {}, + "test-aws-us-west-2a": {}, + "production-aws-us-east-1b": {}, + "test-aws-us-east-1b": {}, + "dev-us-east-1": {}, + "dev-aws-us-east-2a": {}, + "perf-us-east-3": {} + } + } + ] }, { "version": "5.1", @@ -102,8 +254,266 @@ "upgradePolicy": "default", "running": "production-us-west-1" } + ], + "applications": [ + { + "tenant": "tenant1", + "application": "application1", + "instance": "default", + "productionJobCount": 1, + "upgradePolicy": "default", + "allJobs": { + "system-test": { + "failing": { + "number": 2, + "start": 1586278617924, + "end": 1586278617924, + "status": "error" + }, + "running": { + "number": 3, + "start": 1586278617924, + "status": "running" + } + }, + "staging-test": { + "failing": { + "number": 2, + "start": 1586278617924, + "end": 1586278617924, + "status": "error" + }, + "running": { + "number": 3, + "start": 1586278617924, + "status": "running" + } + }, + "production-us-east-3": {}, + "test-us-east-3": {}, + "production-us-west-1": {}, + "test-us-west-1": {}, + "production-us-central-1": {}, + "test-us-central-1": {}, + "production-ap-northeast-1": {}, + "test-ap-northeast-1": {}, + "production-ap-northeast-2": {}, + "test-ap-northeast-2": {}, + "production-ap-southeast-1": {}, + "test-ap-southeast-1": {}, + "production-eu-west-1": {}, + "test-eu-west-1": {}, + "production-aws-us-east-1a": {}, + "test-aws-us-east-1a": {}, + "production-aws-us-west-2a": {}, + "test-aws-us-west-2a": {}, + "production-aws-us-east-1b": {}, + "test-aws-us-east-1b": {}, + "dev-us-east-1": {}, + "dev-aws-us-east-2a": {}, + "perf-us-east-3": {} + }, + "upgradeJobs": { + "system-test": { + "failing": { + "number": 2, + "start": 1586278617924, + "end": 1586278617924, + "status": "error" + }, + "running": { + "number": 3, + "start": 1586278617924, + "status": "running" + } + }, + "staging-test": { + "failing": { + "number": 2, + "start": 1586278617924, + "end": 1586278617924, + "status": "error" + }, + "running": { + "number": 3, + "start": 1586278617924, + "status": "running" + } + }, + "production-us-east-3": {}, + "test-us-east-3": {}, + "production-us-west-1": {}, + "test-us-west-1": {}, + "production-us-central-1": {}, + "test-us-central-1": {}, + "production-ap-northeast-1": {}, + "test-ap-northeast-1": {}, + "production-ap-northeast-2": {}, + "test-ap-northeast-2": {}, + "production-ap-southeast-1": {}, + "test-ap-southeast-1": {}, + "production-eu-west-1": {}, + "test-eu-west-1": {}, + "production-aws-us-east-1a": {}, + "test-aws-us-east-1a": {}, + "production-aws-us-west-2a": {}, + "test-aws-us-west-2a": {}, + "production-aws-us-east-1b": {}, + "test-aws-us-east-1b": {}, + "dev-us-east-1": {}, + "dev-aws-us-east-2a": {}, + "perf-us-east-3": {} + } + }, + { + "tenant": "tenant2", + "application": "application2", + "instance": "i2", + "productionJobCount": 1, + "upgradePolicy": "default", + "allJobs": { + "system-test": {}, + "staging-test": {}, + "production-us-east-3": {}, + "test-us-east-3": {}, + "production-us-west-1": { + "running": { + "number": 2, + "start": 1586278617924, + "status": "running" + } + }, + "test-us-west-1": {}, + "production-us-central-1": {}, + "test-us-central-1": {}, + "production-ap-northeast-1": {}, + "test-ap-northeast-1": {}, + "production-ap-northeast-2": {}, + "test-ap-northeast-2": {}, + "production-ap-southeast-1": {}, + "test-ap-southeast-1": {}, + "production-eu-west-1": {}, + "test-eu-west-1": {}, + "production-aws-us-east-1a": {}, + "test-aws-us-east-1a": {}, + "production-aws-us-west-2a": {}, + "test-aws-us-west-2a": {}, + "production-aws-us-east-1b": {}, + "test-aws-us-east-1b": {}, + "dev-us-east-1": {}, + "dev-aws-us-east-2a": {}, + "perf-us-east-3": {} + }, + "upgradeJobs": { + "system-test": {}, + "staging-test": {}, + "production-us-east-3": {}, + "test-us-east-3": {}, + "production-us-west-1": { + "running": { + "number": 2, + "start": 1586278617924, + "status": "running" + } + }, + "test-us-west-1": {}, + "production-us-central-1": {}, + "test-us-central-1": {}, + "production-ap-northeast-1": {}, + "test-ap-northeast-1": {}, + "production-ap-northeast-2": {}, + "test-ap-northeast-2": {}, + "production-ap-southeast-1": {}, + "test-ap-southeast-1": {}, + "production-eu-west-1": {}, + "test-eu-west-1": {}, + "production-aws-us-east-1a": {}, + "test-aws-us-east-1a": {}, + "production-aws-us-west-2a": {}, + "test-aws-us-west-2a": {}, + "production-aws-us-east-1b": {}, + "test-aws-us-east-1b": {}, + "dev-us-east-1": {}, + "dev-aws-us-east-2a": {}, + "perf-us-east-3": {} + } + }, + { + "tenant": "tenant2", + "application": "application2", + "instance": "i1", + "productionJobCount": 1, + "upgradePolicy": "default", + "allJobs": { + "system-test": {}, + "staging-test": {}, + "production-us-east-3": {}, + "test-us-east-3": {}, + "production-us-west-1": { + "success": { + "number": 2, + "start": 1586278617924, + "end": 1586278617924, + "status": "success" + } + }, + "test-us-west-1": {}, + "production-us-central-1": {}, + "test-us-central-1": {}, + "production-ap-northeast-1": {}, + "test-ap-northeast-1": {}, + "production-ap-northeast-2": {}, + "test-ap-northeast-2": {}, + "production-ap-southeast-1": {}, + "test-ap-southeast-1": {}, + "production-eu-west-1": {}, + "test-eu-west-1": {}, + "production-aws-us-east-1a": {}, + "test-aws-us-east-1a": {}, + "production-aws-us-west-2a": {}, + "test-aws-us-west-2a": {}, + "production-aws-us-east-1b": {}, + "test-aws-us-east-1b": {}, + "dev-us-east-1": {}, + "dev-aws-us-east-2a": {}, + "perf-us-east-3": {} + }, + "upgradeJobs": { + "system-test": {}, + "staging-test": {}, + "production-us-east-3": {}, + "test-us-east-3": {}, + "production-us-west-1": { + "success": { + "number": 2, + "start": 1586278617924, + "end": 1586278617924, + "status": "success" + } + }, + "test-us-west-1": {}, + "production-us-central-1": {}, + "test-us-central-1": {}, + "production-ap-northeast-1": {}, + "test-ap-northeast-1": {}, + "production-ap-northeast-2": {}, + "test-ap-northeast-2": {}, + "production-ap-southeast-1": {}, + "test-ap-southeast-1": {}, + "production-eu-west-1": {}, + "test-eu-west-1": {}, + "production-aws-us-east-1a": {}, + "test-aws-us-east-1a": {}, + "production-aws-us-west-2a": {}, + "test-aws-us-west-2a": {}, + "production-aws-us-east-1b": {}, + "test-aws-us-east-1b": {}, + "dev-us-east-1": {}, + "dev-aws-us-east-2a": {}, + "perf-us-east-3": {} + } + } ] } ] } - -- cgit v1.2.3 From 7bae03fa21e90e67c64d46caf0ad1c3eaf2714d0 Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Tue, 7 Apr 2020 20:48:47 +0200 Subject: List jobs explicitly --- .../restapi/deployment/DeploymentApiHandler.java | 14 +- .../restapi/deployment/DeploymentApiTest.java | 3 + .../restapi/deployment/responses/root.json | 380 ++++++--------------- 3 files changed, 113 insertions(+), 284 deletions(-) (limited to 'controller-server') diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java index b1706e044bd..ec1ff1ebc99 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiHandler.java @@ -33,6 +33,7 @@ import java.util.stream.Stream; import static java.util.function.Function.identity; import static java.util.stream.Collectors.groupingBy; +import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toMap; import static java.util.stream.Collectors.toUnmodifiableMap; @@ -93,7 +94,7 @@ public class DeploymentApiHandler extends LoggingRequestHandler { var versionStatus = controller.versionStatus(); var systemVersion = versionStatus.systemVersion().map(VespaVersion::versionNumber).orElse(Vtag.currentVersion); var deploymentStatuses = controller.jobController().deploymentStatuses(ApplicationList.from(controller.applications().asList()), systemVersion); - var deploymentStatistics = DeploymentStatistics.compute(versionStatus.versions().stream().map(VespaVersion::versionNumber).collect(Collectors.toList()), + var deploymentStatistics = DeploymentStatistics.compute(versionStatus.versions().stream().map(VespaVersion::versionNumber).collect(toList()), deploymentStatuses) .stream().collect(toMap(DeploymentStatistics::version, identity())); for (VespaVersion version : versionStatus.versions()) { @@ -155,7 +156,9 @@ public class DeploymentApiHandler extends LoggingRequestHandler { .flatMap(identity()) .collect(Collectors.groupingBy(run -> run.run.id().application(), LinkedHashMap::new, // Put apps with failing and running jobs first. - groupingBy(run -> run.run.id().type()))) + groupingBy(run -> run.run.id().type(), + LinkedHashMap::new, + toList()))) .forEach((instance, runs) -> { Cursor instanceObject = instancesArray.addObject(); instanceObject.setString("tenant", instance.tenant().value()); @@ -168,17 +171,18 @@ public class DeploymentApiHandler extends LoggingRequestHandler { .orElse(DeploymentSpec.UpgradePolicy.defaultPolicy))); Cursor allJobsObject = instanceObject.setObject("allJobs"); Cursor upgradeJobsObject = instanceObject.setObject("upgradeJobs"); - for (JobType type : JobType.allIn(controller.system())) { + runs.forEach((type, rs) -> { Cursor jobObject = allJobsObject.setObject(type.jobName()); Cursor upgradeObject = upgradeJobsObject.setObject(type.jobName()); - for (RunInfo run : runs.getOrDefault(type, List.of())) { + for (RunInfo run : rs) { toSlime(jobObject, run.run); if (run.upgrade) toSlime(upgradeObject, run.run); } - } + }); }); } + JobType.allIn(controller.system()).stream().map(JobType::jobName).forEach(root.setArray("jobs")::addString); return new SlimeJsonResponse(slime); } 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 2118f221a79..c8036676fa9 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 @@ -69,6 +69,9 @@ public class DeploymentApiTest extends ControllerContainerTest { deploymentTester.upgrader().maintain(); deploymentTester.triggerJobs(); + // Application fails application change + productionApp.submit(multiInstancePackage).failDeployment(JobType.systemTest); + tester.controller().updateVersionStatus(censorConfigServers(VersionStatus.compute(tester.controller()))); tester.assertResponse(authenticatedRequest("http://localhost:8080/deployment/v1/"), new File("root.json")); tester.assertResponse(authenticatedRequest("http://localhost:8080/api/deployment/v1/"), new File("root.json")); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json index 88c9c5030cf..f44c3bce8a8 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/responses/root.json @@ -38,72 +38,24 @@ "productionJobCount": 1, "upgradePolicy": "default", "allJobs": { - "system-test": {}, - "staging-test": {}, - "production-us-east-3": {}, - "test-us-east-3": {}, "production-us-west-1": { "success": { "number": 1, - "start": 1586278617924, - "end": 1586278617924, + "start": "(ignore)", + "end": "(ignore)", "status": "success" } - }, - "test-us-west-1": {}, - "production-us-central-1": {}, - "test-us-central-1": {}, - "production-ap-northeast-1": {}, - "test-ap-northeast-1": {}, - "production-ap-northeast-2": {}, - "test-ap-northeast-2": {}, - "production-ap-southeast-1": {}, - "test-ap-southeast-1": {}, - "production-eu-west-1": {}, - "test-eu-west-1": {}, - "production-aws-us-east-1a": {}, - "test-aws-us-east-1a": {}, - "production-aws-us-west-2a": {}, - "test-aws-us-west-2a": {}, - "production-aws-us-east-1b": {}, - "test-aws-us-east-1b": {}, - "dev-us-east-1": {}, - "dev-aws-us-east-2a": {}, - "perf-us-east-3": {} + } }, "upgradeJobs": { - "system-test": {}, - "staging-test": {}, - "production-us-east-3": {}, - "test-us-east-3": {}, "production-us-west-1": { "success": { "number": 1, - "start": 1586278617924, - "end": 1586278617924, + "start": "(ignore)", + "end": "(ignore)", "status": "success" } - }, - "test-us-west-1": {}, - "production-us-central-1": {}, - "test-us-central-1": {}, - "production-ap-northeast-1": {}, - "test-ap-northeast-1": {}, - "production-ap-northeast-2": {}, - "test-ap-northeast-2": {}, - "production-ap-southeast-1": {}, - "test-ap-southeast-1": {}, - "production-eu-west-1": {}, - "test-eu-west-1": {}, - "production-aws-us-east-1a": {}, - "test-aws-us-east-1a": {}, - "production-aws-us-west-2a": {}, - "test-aws-us-west-2a": {}, - "production-aws-us-east-1b": {}, - "test-aws-us-east-1b": {}, - "dev-us-east-1": {}, - "dev-aws-us-east-2a": {}, - "perf-us-east-3": {} + } } }, { @@ -113,72 +65,24 @@ "productionJobCount": 1, "upgradePolicy": "default", "allJobs": { - "system-test": {}, - "staging-test": {}, - "production-us-east-3": {}, - "test-us-east-3": {}, "production-us-west-1": { "success": { "number": 1, - "start": 1586278617924, - "end": 1586278617924, + "start": "(ignore)", + "end": "(ignore)", "status": "success" } - }, - "test-us-west-1": {}, - "production-us-central-1": {}, - "test-us-central-1": {}, - "production-ap-northeast-1": {}, - "test-ap-northeast-1": {}, - "production-ap-northeast-2": {}, - "test-ap-northeast-2": {}, - "production-ap-southeast-1": {}, - "test-ap-southeast-1": {}, - "production-eu-west-1": {}, - "test-eu-west-1": {}, - "production-aws-us-east-1a": {}, - "test-aws-us-east-1a": {}, - "production-aws-us-west-2a": {}, - "test-aws-us-west-2a": {}, - "production-aws-us-east-1b": {}, - "test-aws-us-east-1b": {}, - "dev-us-east-1": {}, - "dev-aws-us-east-2a": {}, - "perf-us-east-3": {} + } }, "upgradeJobs": { - "system-test": {}, - "staging-test": {}, - "production-us-east-3": {}, - "test-us-east-3": {}, "production-us-west-1": { "success": { "number": 1, - "start": 1586278617924, - "end": 1586278617924, + "start": "(ignore)", + "end": "(ignore)", "status": "success" } - }, - "test-us-west-1": {}, - "production-us-central-1": {}, - "test-us-central-1": {}, - "production-ap-northeast-1": {}, - "test-ap-northeast-1": {}, - "production-ap-northeast-2": {}, - "test-ap-northeast-2": {}, - "production-ap-southeast-1": {}, - "test-ap-southeast-1": {}, - "production-eu-west-1": {}, - "test-eu-west-1": {}, - "production-aws-us-east-1a": {}, - "test-aws-us-east-1a": {}, - "production-aws-us-west-2a": {}, - "test-aws-us-west-2a": {}, - "production-aws-us-east-1b": {}, - "test-aws-us-east-1b": {}, - "dev-us-east-1": {}, - "dev-aws-us-east-2a": {}, - "perf-us-east-3": {} + } } } ] @@ -266,254 +170,172 @@ "system-test": { "failing": { "number": 2, - "start": 1586278617924, - "end": 1586278617924, + "start": "(ignore)", + "end": "(ignore)", "status": "error" }, "running": { "number": 3, - "start": 1586278617924, + "start": "(ignore)", "status": "running" } }, "staging-test": { "failing": { "number": 2, - "start": 1586278617924, - "end": 1586278617924, + "start": "(ignore)", + "end": "(ignore)", "status": "error" }, "running": { "number": 3, - "start": 1586278617924, + "start": "(ignore)", "status": "running" } - }, - "production-us-east-3": {}, - "test-us-east-3": {}, - "production-us-west-1": {}, - "test-us-west-1": {}, - "production-us-central-1": {}, - "test-us-central-1": {}, - "production-ap-northeast-1": {}, - "test-ap-northeast-1": {}, - "production-ap-northeast-2": {}, - "test-ap-northeast-2": {}, - "production-ap-southeast-1": {}, - "test-ap-southeast-1": {}, - "production-eu-west-1": {}, - "test-eu-west-1": {}, - "production-aws-us-east-1a": {}, - "test-aws-us-east-1a": {}, - "production-aws-us-west-2a": {}, - "test-aws-us-west-2a": {}, - "production-aws-us-east-1b": {}, - "test-aws-us-east-1b": {}, - "dev-us-east-1": {}, - "dev-aws-us-east-2a": {}, - "perf-us-east-3": {} + } }, "upgradeJobs": { "system-test": { "failing": { "number": 2, - "start": 1586278617924, - "end": 1586278617924, + "start": "(ignore)", + "end": "(ignore)", "status": "error" }, "running": { "number": 3, - "start": 1586278617924, + "start": "(ignore)", "status": "running" } }, "staging-test": { "failing": { "number": 2, - "start": 1586278617924, - "end": 1586278617924, + "start": "(ignore)", + "end": "(ignore)", "status": "error" }, "running": { "number": 3, - "start": 1586278617924, + "start": "(ignore)", "status": "running" } - }, - "production-us-east-3": {}, - "test-us-east-3": {}, - "production-us-west-1": {}, - "test-us-west-1": {}, - "production-us-central-1": {}, - "test-us-central-1": {}, - "production-ap-northeast-1": {}, - "test-ap-northeast-1": {}, - "production-ap-northeast-2": {}, - "test-ap-northeast-2": {}, - "production-ap-southeast-1": {}, - "test-ap-southeast-1": {}, - "production-eu-west-1": {}, - "test-eu-west-1": {}, - "production-aws-us-east-1a": {}, - "test-aws-us-east-1a": {}, - "production-aws-us-west-2a": {}, - "test-aws-us-west-2a": {}, - "production-aws-us-east-1b": {}, - "test-aws-us-east-1b": {}, - "dev-us-east-1": {}, - "dev-aws-us-east-2a": {}, - "perf-us-east-3": {} + } } }, { "tenant": "tenant2", "application": "application2", - "instance": "i2", + "instance": "i1", "productionJobCount": 1, "upgradePolicy": "default", "allJobs": { - "system-test": {}, - "staging-test": {}, - "production-us-east-3": {}, - "test-us-east-3": {}, - "production-us-west-1": { + "system-test": { + "failing": { + "number": 3, + "start": "(ignore)", + "end": "(ignore)", + "status": "error" + } + }, + "staging-test": { "running": { - "number": 2, - "start": 1586278617924, + "number": 3, + "start": "(ignore)", "status": "running" } }, - "test-us-west-1": {}, - "production-us-central-1": {}, - "test-us-central-1": {}, - "production-ap-northeast-1": {}, - "test-ap-northeast-1": {}, - "production-ap-northeast-2": {}, - "test-ap-northeast-2": {}, - "production-ap-southeast-1": {}, - "test-ap-southeast-1": {}, - "production-eu-west-1": {}, - "test-eu-west-1": {}, - "production-aws-us-east-1a": {}, - "test-aws-us-east-1a": {}, - "production-aws-us-west-2a": {}, - "test-aws-us-west-2a": {}, - "production-aws-us-east-1b": {}, - "test-aws-us-east-1b": {}, - "dev-us-east-1": {}, - "dev-aws-us-east-2a": {}, - "perf-us-east-3": {} + "production-us-west-1": { + "success": { + "number": 2, + "start": "(ignore)", + "end": "(ignore)", + "status": "success" + } + } }, "upgradeJobs": { "system-test": {}, "staging-test": {}, - "production-us-east-3": {}, - "test-us-east-3": {}, "production-us-west-1": { - "running": { + "success": { "number": 2, - "start": 1586278617924, - "status": "running" + "start": "(ignore)", + "end": "(ignore)", + "status": "success" } - }, - "test-us-west-1": {}, - "production-us-central-1": {}, - "test-us-central-1": {}, - "production-ap-northeast-1": {}, - "test-ap-northeast-1": {}, - "production-ap-northeast-2": {}, - "test-ap-northeast-2": {}, - "production-ap-southeast-1": {}, - "test-ap-southeast-1": {}, - "production-eu-west-1": {}, - "test-eu-west-1": {}, - "production-aws-us-east-1a": {}, - "test-aws-us-east-1a": {}, - "production-aws-us-west-2a": {}, - "test-aws-us-west-2a": {}, - "production-aws-us-east-1b": {}, - "test-aws-us-east-1b": {}, - "dev-us-east-1": {}, - "dev-aws-us-east-2a": {}, - "perf-us-east-3": {} + } } }, { "tenant": "tenant2", "application": "application2", - "instance": "i1", + "instance": "i2", "productionJobCount": 1, "upgradePolicy": "default", "allJobs": { - "system-test": {}, - "staging-test": {}, - "production-us-east-3": {}, - "test-us-east-3": {}, "production-us-west-1": { - "success": { + "running": { "number": 2, - "start": 1586278617924, - "end": 1586278617924, - "status": "success" + "start": "(ignore)", + "status": "running" + } + }, + "system-test": { + "running": { + "number": 1, + "start": "(ignore)", + "status": "running" } }, - "test-us-west-1": {}, - "production-us-central-1": {}, - "test-us-central-1": {}, - "production-ap-northeast-1": {}, - "test-ap-northeast-1": {}, - "production-ap-northeast-2": {}, - "test-ap-northeast-2": {}, - "production-ap-southeast-1": {}, - "test-ap-southeast-1": {}, - "production-eu-west-1": {}, - "test-eu-west-1": {}, - "production-aws-us-east-1a": {}, - "test-aws-us-east-1a": {}, - "production-aws-us-west-2a": {}, - "test-aws-us-west-2a": {}, - "production-aws-us-east-1b": {}, - "test-aws-us-east-1b": {}, - "dev-us-east-1": {}, - "dev-aws-us-east-2a": {}, - "perf-us-east-3": {} + "staging-test": { + "running": { + "number": 1, + "start": "(ignore)", + "status": "running" + } + } }, "upgradeJobs": { - "system-test": {}, - "staging-test": {}, - "production-us-east-3": {}, - "test-us-east-3": {}, "production-us-west-1": { - "success": { + "running": { "number": 2, - "start": 1586278617924, - "end": 1586278617924, - "status": "success" + "start": "(ignore)", + "status": "running" } }, - "test-us-west-1": {}, - "production-us-central-1": {}, - "test-us-central-1": {}, - "production-ap-northeast-1": {}, - "test-ap-northeast-1": {}, - "production-ap-northeast-2": {}, - "test-ap-northeast-2": {}, - "production-ap-southeast-1": {}, - "test-ap-southeast-1": {}, - "production-eu-west-1": {}, - "test-eu-west-1": {}, - "production-aws-us-east-1a": {}, - "test-aws-us-east-1a": {}, - "production-aws-us-west-2a": {}, - "test-aws-us-west-2a": {}, - "production-aws-us-east-1b": {}, - "test-aws-us-east-1b": {}, - "dev-us-east-1": {}, - "dev-aws-us-east-2a": {}, - "perf-us-east-3": {} + "system-test": {}, + "staging-test": {} } } ] } + ], + "jobs": [ + "system-test", + "staging-test", + "production-us-east-3", + "test-us-east-3", + "production-us-west-1", + "test-us-west-1", + "production-us-central-1", + "test-us-central-1", + "production-ap-northeast-1", + "test-ap-northeast-1", + "production-ap-northeast-2", + "test-ap-northeast-2", + "production-ap-southeast-1", + "test-ap-southeast-1", + "production-eu-west-1", + "test-eu-west-1", + "production-aws-us-east-1a", + "test-aws-us-east-1a", + "production-aws-us-west-2a", + "test-aws-us-west-2a", + "production-aws-us-east-1b", + "test-aws-us-east-1b", + "dev-us-east-1", + "dev-aws-us-east-2a", + "perf-us-east-3" ] } -- cgit v1.2.3