diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2019-12-30 10:11:38 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2019-12-30 10:11:38 +0100 |
commit | cef1ea2774e76b515b0118befa4328ebb6040abc (patch) | |
tree | 63b87668a7eefb7e7d55e4b1b9c1d8689d97f869 /controller-server | |
parent | 8c10f5aabeab43d115bf26f8cea551024cd1d774 (diff) |
Expose deployment overview under application/v4/app-path/deployment
Diffstat (limited to 'controller-server')
6 files changed, 585 insertions, 6 deletions
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 a423a95d2ff..9f6047d5968 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 @@ -212,6 +212,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { if (path.matches("/application/v4/tenant/{tenant}/cost/{month}")) return tenantCost(path.get("tenant"), path.get("month"), request); if (path.matches("/application/v4/tenant/{tenant}/application")) return applications(path.get("tenant"), Optional.empty(), request); if (path.matches("/application/v4/tenant/{tenant}/application/{application}")) return application(path.get("tenant"), path.get("application"), request); + if (path.matches("/application/v4/tenant/{tenant}/application/{application}/deployment")) return JobControllerApiHandlerHelper.overviewResponse(controller, TenantAndApplicationId.from(path.get("tenant"), path.get("application")), request.getUri()); if (path.matches("/application/v4/tenant/{tenant}/application/{application}/package")) return applicationPackage(path.get("tenant"), path.get("application"), request); if (path.matches("/application/v4/tenant/{tenant}/application/{application}/deploying")) return deploying(path.get("tenant"), path.get("application"), request); if (path.matches("/application/v4/tenant/{tenant}/application/{application}/deploying/pin")) return deploying(path.get("tenant"), path.get("application"), request); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java index b49d34280ff..a3923e4c1d7 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java @@ -73,12 +73,6 @@ import static java.util.stream.Collectors.toMap; */ class JobControllerApiHandlerHelper { - static HttpResponse applicationJobs(Controller controller, TenantAndApplicationId id, URI baseUriForJobs) { - DeploymentStatus status = controller.jobController().deploymentStatus(controller.applications().requireApplication(id)); - - return null; - } - /** * @return Response with all job types that have recorded runs for the application _and_ the status for the last run of that type */ @@ -578,6 +572,8 @@ class JobControllerApiHandlerHelper { }); } + // TODO jonmv: Add latest platform and application status, and lists of runs for each of the jobs. + return new SlimeJsonResponse(slime); } 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 cb032615fc6..cbc7a5477c4 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 @@ -700,6 +700,11 @@ public class ApplicationApiTest extends ControllerContainerTest { .userIdentity(USER_ID), new File("jobs.json")); + // GET deployment job overview for whole application. + tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/deployment", GET) + .userIdentity(USER_ID), + new File("deployment-overview.json")); + // GET system test job overview. tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/job/system-test", GET) .userIdentity(USER_ID), diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java index 065838454b8..b53a4862192 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java @@ -140,6 +140,8 @@ public class JobControllerApiHandlerHelperTest { userApp.runJob(devAwsUsEast2a, applicationPackage); assertResponse(JobControllerApiHandlerHelper.runResponse(tester.jobs().runs(userApp.instanceId(), devAwsUsEast2a), URI.create("https://some.url:43/root")), "dev-aws-us-east-2a-runs.json"); assertResponse(JobControllerApiHandlerHelper.jobTypeResponse(tester.controller(), userApp.instanceId(), URI.create("https://some.url:43/root/")), "overview-user-instance.json"); + + assertResponse(JobControllerApiHandlerHelper.overviewResponse(tester.controller(), app.application().id(), URI.create("https://some.url:43/root/")), "deployment-overview-2.json"); } @Test diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview-2.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview-2.json new file mode 100644 index 00000000000..3406ad47a33 --- /dev/null +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview-2.json @@ -0,0 +1,299 @@ +{ + "tenant": "tenant", + "application": "application", + "steps": [ + { + "type": "test", + "dependencies": [], + "declared": true, + "instance": "default", + "jobName": "staging-test", + "environment": "staging", + "region": "staging.us-east-3", + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 3, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "sourcePlatform": "6.1.0", + "sourceApplication": { + "id": 1, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "readyAt": 752000, + "delayedUntil": 752000, + "coolingDownUntil": 752000, + "running": false + } + ], + "lastRun": { + "start": 102000, + "end": 102000, + "status": "installationFailed", + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 3, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "sourcePlatform": "6.1.0", + "sourceApplication": { + "id": 1, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + } + } + }, + { + "type": "test", + "dependencies": [], + "declared": false, + "instance": "default", + "jobName": "system-test", + "environment": "test", + "region": "test.us-east-1", + "jobs": [], + "lastRun": { + "start": 2000, + "end": 2000, + "status": "success", + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 3, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "sourcePlatform": "6.1.0", + "sourceApplication": { + "id": 2, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + } + } + }, + { + "type": "deployment", + "dependencies": [ + 0 + ], + "declared": true, + "instance": "default", + "jobName": "production-us-central-1", + "environment": "prod", + "region": "prod.us-central-1", + "currentPlatform": "6.1.0", + "currentApplication": { + "id": 3, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 3, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "sourcePlatform": "6.1.0", + "sourceApplication": { + "id": 3, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "readyAt": 2000, + "running": true + } + ], + "lastRun": { + "start": 2000, + "status": "running", + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 3, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "sourcePlatform": "6.1.0", + "sourceApplication": { + "id": 2, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + } + } + }, + { + "type": "test", + "dependencies": [ + 2 + ], + "declared": true, + "instance": "default", + "jobName": "test-us-central-1", + "environment": "prod", + "region": "prod.us-central-1", + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 3, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "sourcePlatform": "6.1.0", + "sourceApplication": { + "id": 3, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "running": false + } + ], + "lastRun": { + "start": 1000, + "end": 1000, + "status": "success", + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 2, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "sourcePlatform": "6.1.0", + "sourceApplication": { + "id": 2, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + } + } + }, + { + "type": "deployment", + "dependencies": [ + 3 + ], + "declared": true, + "instance": "default", + "jobName": "production-us-west-1", + "environment": "prod", + "region": "prod.us-west-1", + "currentPlatform": "6.1.0", + "currentApplication": { + "id": 2, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 3, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "sourcePlatform": "6.1.0", + "sourceApplication": { + "id": 2, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "running": false + } + ], + "lastRun": { + "start": 1000, + "end": 1000, + "status": "testFailure", + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 2, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "sourcePlatform": "6.1.0", + "sourceApplication": { + "id": 1, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + } + } + }, + { + "type": "deployment", + "dependencies": [ + 3 + ], + "declared": true, + "instance": "default", + "jobName": "production-us-east-3", + "environment": "prod", + "region": "prod.us-east-3", + "currentPlatform": "6.1.0", + "currentApplication": { + "id": 1, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 3, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "sourcePlatform": "6.1.0", + "sourceApplication": { + "id": 1, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "running": false + } + ], + "lastRun": { + "start": 1000, + "end": 1000, + "status": "deploymentFailed", + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 2, + "commit": "commit1", + "source": "repository1/tree/commit1" + }, + "sourcePlatform": "6.1.0", + "sourceApplication": { + "id": 1, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + } + } + } + ] +}
\ No newline at end of file diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json new file mode 100644 index 00000000000..f4fdac81b0c --- /dev/null +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/deployment-overview.json @@ -0,0 +1,276 @@ +{ + "tenant": "tenant1", + "application": "application1", + "steps": [ + { + "type": "test", + "dependencies": [], + "declared": false, + "instance": "instance1", + "jobName": "system-test", + "environment": "test", + "region": "test.us-east-1", + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 4, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "readyAt": 0, + "running": true + } + ], + "lastRun": { + "start": "(ignore)", + "status": "running", + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 4, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + } + } + }, + { + "type": "test", + "dependencies": [], + "declared": false, + "instance": "instance1", + "jobName": "staging-test", + "environment": "staging", + "region": "staging.us-east-3", + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 4, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "readyAt": 0, + "running": true + } + ], + "lastRun": { + "start": "(ignore)", + "status": "running", + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 4, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + } + } + }, + { + "type": "deployment", + "dependencies": [], + "declared": true, + "instance": "instance1", + "jobName": "production-us-central-1", + "environment": "prod", + "region": "prod.us-central-1", + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 4, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "running": false + } + ], + "lastRun": { + "start": "(ignore)", + "end": "(ignore)", + "status": "success", + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 1, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + } + } + }, + { + "type": "deployment", + "dependencies": [ + 2 + ], + "declared": true, + "instance": "instance1", + "jobName": "production-us-west-1", + "environment": "prod", + "region": "prod.us-west-1", + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 4, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "running": false + } + ], + "lastRun": { + "start": "(ignore)", + "status": "aborted", + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 1, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + } + } + }, + { + "type": "deployment", + "dependencies": [ + 2 + ], + "declared": true, + "instance": "instance1", + "jobName": "production-us-east-3", + "environment": "prod", + "region": "prod.us-east-3", + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 4, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "running": false + } + ], + "lastRun": { + "start": "(ignore)", + "status": "aborted", + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 1, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + } + } + }, + { + "type": "test", + "dependencies": [], + "declared": false, + "instance": "instance2", + "jobName": "system-test", + "environment": "test", + "region": "test.us-east-1", + "jobs": [] + }, + { + "type": "test", + "dependencies": [], + "declared": false, + "instance": "instance2", + "jobName": "staging-test", + "environment": "staging", + "region": "staging.us-east-3", + "jobs": [] + }, + { + "type": "deployment", + "dependencies": [ + 3, + 4 + ], + "declared": true, + "instance": "instance2", + "jobName": "production-us-central-1", + "environment": "prod", + "region": "prod.us-central-1", + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 4, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "running": false + } + ] + }, + { + "type": "deployment", + "dependencies": [ + 7 + ], + "declared": true, + "instance": "instance2", + "jobName": "production-us-west-1", + "environment": "prod", + "region": "prod.us-west-1", + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 4, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "running": false + } + ] + }, + { + "type": "deployment", + "dependencies": [ + 7 + ], + "declared": true, + "instance": "instance2", + "jobName": "production-us-east-3", + "environment": "prod", + "region": "prod.us-east-3", + "jobs": [ + { + "versions": { + "targetPlatform": "6.1.0", + "targetApplication": { + "id": 4, + "commit": "commit1", + "source": "repository1/tree/commit1" + } + }, + "running": false + } + ] + } + ] +} |