From b62e234f2cb9015c351c4429c8109c782405f795 Mon Sep 17 00:00:00 2001 From: Matias Frank Jensen Date: Thu, 23 May 2024 10:05:47 +0200 Subject: [PATCH 1/2] Added proto for capsule revision endpoints --- proto/rig/api/v1/capsule/service.proto | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/proto/rig/api/v1/capsule/service.proto b/proto/rig/api/v1/capsule/service.proto index df8fac85a..9111b86e4 100644 --- a/proto/rig/api/v1/capsule/service.proto +++ b/proto/rig/api/v1/capsule/service.proto @@ -9,10 +9,13 @@ import "api/v1/capsule/rollout.proto"; import "api/v1/capsule/instance/status.proto"; import "api/v1/capsule/event.proto"; import "api/v1/capsule/job.proto"; +import "platform/v1/generated.proto"; import "api/v1/capsule/metrics.proto"; import "api/v1/capsule/change.proto"; import "api/v1/capsule/status.proto"; +import "api/v1/capsule/revision.proto"; import "model/common.proto"; +import "model/revision.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; @@ -35,6 +38,9 @@ service Service { // running at a single point in time. // Use `Abort` to abort an already running rollout. rpc Deploy(DeployRequest) returns (DeployResponse) {} + // Applies a Capsule spec in an environment which will be rolled out + rpc ApplyCapsuleSpec(ApplyCapsuleSpecRequest) + returns (ApplyCapsuleSpecResponse) {} // Lists all instances for the capsule. rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) {} // Restart a single capsule instance. @@ -70,6 +76,7 @@ service Service { returns (GetJobExecutionsResponse) {} rpc GetStatus(GetStatusRequest) returns (GetStatusResponse) {} + rpc GetRevision(GetRevisionRequest) returns (GetRevisionResponse) {} } // GetStatusRequest is a request to start streaming the capsule status @@ -180,6 +187,8 @@ message GetRequest { message GetResponse { // The capsule. api.v1.capsule.Capsule capsule = 1; + api.v1.capsule.SetRevision revision = 2; + map environment_revisions = 3; } // Request to delete a capsule. @@ -289,6 +298,19 @@ message DeployResponse { api.v1.capsule.RolloutConfig rollout_config = 3; } +message ApplyCapsuleSpecRequest { + platform.v1.CapsuleSpec spec = 1; + string project_id = 2; + string environment_id = 3; + string capsule_id = 4; + model.Fingerprint current_fingerprint = 5; + bool dry_run = 6; +} + +message ApplyCapsuleSpecResponse { + model.Fingerprint fingerprint = 1; +} + // List instances request. message ListInstancesRequest { // Capsule to list instances from. @@ -404,6 +426,7 @@ message GetRolloutRequest { message GetRolloutResponse { // The rollout. api.v1.capsule.Rollout rollout = 1; + capsule.Revision revision = 2; } // AbortRolloutRequest aborts a rollout. @@ -528,3 +551,14 @@ message GetJobExecutionsResponse { // Total number of executions ignorring pagination. uint64 total = 2; } + +message GetRevisionRequest { + string project_id = 1; + string environment_id = 2; + string capsule_id = 3; + model.Fingerprint fingerprint = 4; +} + +message GetRevisionResponse { + Revision revision = 1; +} From 41e1569c7901c6b44666abfb60e6e91f7dec0c16 Mon Sep 17 00:00:00 2001 From: Matias Frank Jensen Date: Thu, 23 May 2024 10:16:19 +0200 Subject: [PATCH 2/2] fix --- docs/docs/api/platform-api.md | 89 +++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/docs/docs/api/platform-api.md b/docs/docs/api/platform-api.md index 74bb43c42..e72d97b84 100644 --- a/docs/docs/api/platform-api.md +++ b/docs/docs/api/platform-api.md @@ -63,6 +63,7 @@ | /api.v1.capsule.Service/Update | [UpdateRequest](#api-v1-capsule-UpdateRequest) | [UpdateResponse](#api-v1-capsule-UpdateResponse) | Update a capsule. | | /api.v1.capsule.Service/List | [ListRequest](#api-v1-capsule-ListRequest) | [ListResponse](#api-v1-capsule-ListResponse) | Lists all capsules for current project. | | /api.v1.capsule.Service/Deploy | [DeployRequest](#api-v1-capsule-DeployRequest) | [DeployResponse](#api-v1-capsule-DeployResponse) | Deploy changes to a capsule. When deploying, a new rollout will be initiated. Only one rollout can be running at a single point in time. Use `Abort` to abort an already running rollout. | +| /api.v1.capsule.Service/ApplyCapsuleSpec | [ApplyCapsuleSpecRequest](#api-v1-capsule-ApplyCapsuleSpecRequest) | [ApplyCapsuleSpecResponse](#api-v1-capsule-ApplyCapsuleSpecResponse) | Applies a Capsule spec in an environment which will be rolled out | | /api.v1.capsule.Service/ListInstances | [ListInstancesRequest](#api-v1-capsule-ListInstancesRequest) | [ListInstancesResponse](#api-v1-capsule-ListInstancesResponse) | Lists all instances for the capsule. | | /api.v1.capsule.Service/RestartInstance | [RestartInstanceRequest](#api-v1-capsule-RestartInstanceRequest) | [RestartInstanceResponse](#api-v1-capsule-RestartInstanceResponse) | Restart a single capsule instance. | | /api.v1.capsule.Service/GetRollout | [GetRolloutRequest](#api-v1-capsule-GetRolloutRequest) | [GetRolloutResponse](#api-v1-capsule-GetRolloutResponse) | Get a single rollout by ID. | @@ -77,6 +78,7 @@ | /api.v1.capsule.Service/GetCustomInstanceMetrics | [GetCustomInstanceMetricsRequest](#api-v1-capsule-GetCustomInstanceMetricsRequest) | [GetCustomInstanceMetricsResponse](#api-v1-capsule-GetCustomInstanceMetricsResponse) | | | /api.v1.capsule.Service/GetJobExecutions | [GetJobExecutionsRequest](#api-v1-capsule-GetJobExecutionsRequest) | [GetJobExecutionsResponse](#api-v1-capsule-GetJobExecutionsResponse) | Get list of job executions performed by the Capsule. | | /api.v1.capsule.Service/GetStatus | [GetStatusRequest](#api-v1-capsule-GetStatusRequest) | [GetStatusResponse](#api-v1-capsule-GetStatusResponse) | | +| /api.v1.capsule.Service/GetRevision | [GetRevisionRequest](#api-v1-capsule-GetRevisionRequest) | [GetRevisionResponse](#api-v1-capsule-GetRevisionResponse) | | @@ -4640,6 +4642,41 @@ AbortRolloutResponse is an empty response. + + +### ApplyCapsuleSpecRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| spec | [platform.v1.CapsuleSpec](#platform-v1-CapsuleSpec) | | | +| project_id | [string](#string) | | | +| environment_id | [string](#string) | | | +| capsule_id | [string](#string) | | | +| current_fingerprint | [model.Fingerprint](#model-Fingerprint) | | | +| dry_run | [bool](#bool) | | | + + + + + + + + +### ApplyCapsuleSpecResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| fingerprint | [model.Fingerprint](#model-Fingerprint) | | | + + + + + + ### CapsuleMetricsRequest @@ -4990,6 +5027,57 @@ Response to get a capsule. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | capsule | [Capsule](#api-v1-capsule-Capsule) | | The capsule. | +| revision | [SetRevision](#api-v1-capsule-SetRevision) | | | +| environment_revisions | [GetResponse.EnvironmentRevisionsEntry](#api-v1-capsule-GetResponse-EnvironmentRevisionsEntry) | repeated | | + + + + + + + + +### GetResponse.EnvironmentRevisionsEntry + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| key | [string](#string) | | | +| value | [Revision](#api-v1-capsule-Revision) | | | + + + + + + + + +### GetRevisionRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| project_id | [string](#string) | | | +| environment_id | [string](#string) | | | +| capsule_id | [string](#string) | | | +| fingerprint | [model.Fingerprint](#model-Fingerprint) | | | + + + + + + + + +### GetRevisionResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| revision | [Revision](#api-v1-capsule-Revision) | | | @@ -5023,6 +5111,7 @@ in a project. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | rollout | [Rollout](#api-v1-capsule-Rollout) | | The rollout. | +| revision | [Revision](#api-v1-capsule-Revision) | | |