Skip to content

Commit c940ce2

Browse files
Google APIscopybara-github
authored andcommitted
feat: added support for predeploy and postdeploy actions
Users can now configure predeploy and postdeploy actions as a part of Deploy Hooks. PiperOrigin-RevId: 551539532
1 parent 3f76966 commit c940ce2

2 files changed

Lines changed: 175 additions & 4 deletions

File tree

google/cloud/deploy/v1/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ load(
349349

350350
csharp_proto_library(
351351
name = "deploy_csharp_proto",
352+
extra_opts = [],
352353
deps = [":deploy_proto"],
353354
)
354355

google/cloud/deploy/v1/cloud_deploy.proto

Lines changed: 174 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,32 @@ message Strategy {
446446
}
447447
}
448448

449+
// Predeploy contains the predeploy job configuration information.
450+
message Predeploy {
451+
// Optional. A sequence of skaffold custom actions to invoke during execution
452+
// of the predeploy job.
453+
repeated string actions = 1 [(google.api.field_behavior) = OPTIONAL];
454+
}
455+
456+
// Postdeploy contains the postdeploy job configuration information.
457+
message Postdeploy {
458+
// Optional. A sequence of skaffold custom actions to invoke during execution
459+
// of the postdeploy job.
460+
repeated string actions = 1 [(google.api.field_behavior) = OPTIONAL];
461+
}
462+
449463
// Standard represents the standard deployment strategy.
450464
message Standard {
451465
// Whether to verify a deployment.
452466
bool verify = 1;
467+
468+
// Optional. Configuration for the predeploy job. If this is not configured,
469+
// predeploy job will not be present.
470+
Predeploy predeploy = 2 [(google.api.field_behavior) = OPTIONAL];
471+
472+
// Optional. Configuration for the postdeploy job. If this is not configured,
473+
// postdeploy job will not be present.
474+
Postdeploy postdeploy = 3 [(google.api.field_behavior) = OPTIONAL];
453475
}
454476

455477
// Canary represents the canary deployment strategy.
@@ -480,6 +502,14 @@ message CanaryDeployment {
480502

481503
// Whether to run verify tests after each percentage deployment.
482504
bool verify = 2;
505+
506+
// Optional. Configuration for the predeploy job of the first phase. If this
507+
// is not configured, predeploy job will not be present.
508+
Predeploy predeploy = 3 [(google.api.field_behavior) = OPTIONAL];
509+
510+
// Optional. Configuration for the postdeploy job of the last phase. If this
511+
// is not configured, postdeploy job will not be present.
512+
Postdeploy postdeploy = 4 [(google.api.field_behavior) = OPTIONAL];
483513
}
484514

485515
// CustomCanaryDeployment represents the custom canary deployment
@@ -505,6 +535,14 @@ message CustomCanaryDeployment {
505535

506536
// Whether to run verify tests after the deployment.
507537
bool verify = 4;
538+
539+
// Optional. Configuration for the predeploy job of this phase. If this is
540+
// not configured, predeploy job will not be present for this phase.
541+
Predeploy predeploy = 5 [(google.api.field_behavior) = OPTIONAL];
542+
543+
// Optional. Configuration for the postdeploy job of this phase. If this is
544+
// not configured, postdeploy job will not be present for this phase.
545+
Postdeploy postdeploy = 6 [(google.api.field_behavior) = OPTIONAL];
508546
}
509547

510548
// Required. Configuration for each phase in the canary deployment in the
@@ -918,6 +956,12 @@ message ExecutionConfig {
918956

919957
// Use for deployment verification.
920958
VERIFY = 3;
959+
960+
// Use for predeploy job execution.
961+
PREDEPLOY = 4;
962+
963+
// Use for postdeploy job execution.
964+
POSTDEPLOY = 5;
921965
}
922966

923967
// Required. Usages when this configuration should be applied.
@@ -1268,7 +1312,7 @@ message Release {
12681312

12691313
// Cloud Build is not available, either because it is not enabled or
12701314
// because Cloud Deploy has insufficient permissions. See [required
1271-
// permission](/deploy/docs/cloud-deploy-service-account#required_permissions).
1315+
// permission](https://cloud.google.com/deploy/docs/cloud-deploy-service-account#required_permissions).
12721316
CLOUD_BUILD_UNAVAILABLE = 1;
12731317

12741318
// The render operation did not complete successfully; check Cloud Build
@@ -1278,6 +1322,11 @@ message Release {
12781322
// Cloud Build failed to fulfill Cloud Deploy's request. See
12791323
// failure_message for additional details.
12801324
CLOUD_BUILD_REQUEST_FAILED = 3;
1325+
1326+
// The render operation did not complete successfully because the custom
1327+
// action required for predeploy or postdeploy was not found in the
1328+
// skaffold configuration. See failure_message for additional details.
1329+
CUSTOM_ACTION_NOT_FOUND = 5;
12811330
}
12821331

12831332
// Output only. The resource name of the Cloud Build `Build` object that is
@@ -1683,7 +1732,7 @@ message Rollout {
16831732

16841733
// Cloud Build is not available, either because it is not enabled or because
16851734
// Cloud Deploy has insufficient permissions. See [required
1686-
// permission](/deploy/docs/cloud-deploy-service-account#required_permissions).
1735+
// permission](https://cloud.google.com/deploy/docs/cloud-deploy-service-account#required_permissions).
16871736
CLOUD_BUILD_UNAVAILABLE = 1;
16881737

16891738
// The deploy operation did not complete successfully; check Cloud Build
@@ -1891,6 +1940,14 @@ message DeploymentJobs {
18911940

18921941
// Output only. The verify Job. Runs after a deploy if the deploy succeeds.
18931942
Job verify_job = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
1943+
1944+
// Output only. The predeploy Job. This is the predeploy job in the phase.
1945+
// This is the first job of the phase.
1946+
Job predeploy_job = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
1947+
1948+
// Output only. The postdeploy Job. This is the postdeploy job in the phase.
1949+
// This is the last job of the phase.
1950+
Job postdeploy_job = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
18941951
}
18951952

18961953
// ChildRollouts job composition
@@ -1963,6 +2020,13 @@ message Job {
19632020
// Output only. A verify Job.
19642021
VerifyJob verify_job = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
19652022

2023+
// Output only. A predeploy Job.
2024+
PredeployJob predeploy_job = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
2025+
2026+
// Output only. A postdeploy Job.
2027+
PostdeployJob postdeploy_job = 10
2028+
[(google.api.field_behavior) = OUTPUT_ONLY];
2029+
19662030
// Output only. A createChildRollout Job.
19672031
CreateChildRolloutJob create_child_rollout_job = 6
19682032
[(google.api.field_behavior) = OUTPUT_ONLY];
@@ -1979,6 +2043,18 @@ message DeployJob {}
19792043
// A verify Job.
19802044
message VerifyJob {}
19812045

2046+
// A predeploy Job.
2047+
message PredeployJob {
2048+
// Output only. The custom actions that the predeploy Job executes.
2049+
repeated string actions = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
2050+
}
2051+
2052+
// A postdeploy Job.
2053+
message PostdeployJob {
2054+
// Output only. The custom actions that the postdeploy Job executes.
2055+
repeated string actions = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
2056+
}
2057+
19822058
// A createChildRollout Job.
19832059
message CreateChildRolloutJob {}
19842060

@@ -2297,6 +2373,14 @@ message JobRun {
22972373
VerifyJobRun verify_job_run = 10
22982374
[(google.api.field_behavior) = OUTPUT_ONLY];
22992375

2376+
// Output only. Information specific to a predeploy `JobRun`.
2377+
PredeployJobRun predeploy_job_run = 14
2378+
[(google.api.field_behavior) = OUTPUT_ONLY];
2379+
2380+
// Output only. Information specific to a postdeploy `JobRun`.
2381+
PostdeployJobRun postdeploy_job_run = 15
2382+
[(google.api.field_behavior) = OUTPUT_ONLY];
2383+
23002384
// Output only. Information specific to a createChildRollout `JobRun`.
23012385
CreateChildRolloutJobRun create_child_rollout_job_run = 12
23022386
[(google.api.field_behavior) = OUTPUT_ONLY];
@@ -2321,7 +2405,7 @@ message DeployJobRun {
23212405

23222406
// Cloud Build is not available, either because it is not enabled or because
23232407
// Cloud Deploy has insufficient permissions. See [Required
2324-
// permission](/deploy/docs/cloud-deploy-service-account#required_permissions).
2408+
// permission](https://cloud.google.com/deploy/docs/cloud-deploy-service-account#required_permissions).
23252409
CLOUD_BUILD_UNAVAILABLE = 1;
23262410

23272411
// The deploy operation did not complete successfully; check Cloud Build
@@ -2373,7 +2457,7 @@ message VerifyJobRun {
23732457

23742458
// Cloud Build is not available, either because it is not enabled or because
23752459
// Cloud Deploy has insufficient permissions. See [required
2376-
// permission](/deploy/docs/cloud-deploy-service-account#required_permissions).
2460+
// permission](https://cloud.google.com/deploy/docs/cloud-deploy-service-account#required_permissions).
23772461
CLOUD_BUILD_UNAVAILABLE = 1;
23782462

23792463
// The verify operation did not complete successfully; check Cloud Build
@@ -2417,6 +2501,92 @@ message VerifyJobRun {
24172501
string failure_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
24182502
}
24192503

2504+
// PredeployJobRun contains information specific to a predeploy `JobRun`.
2505+
message PredeployJobRun {
2506+
// Well-known predeploy failures.
2507+
enum FailureCause {
2508+
// No reason for failure is specified.
2509+
FAILURE_CAUSE_UNSPECIFIED = 0;
2510+
2511+
// Cloud Build is not available, either because it is not enabled or because
2512+
// Cloud Deploy has insufficient permissions. See [required
2513+
// permission](https://cloud.google.com/deploy/docs/cloud-deploy-service-account#required_permissions).
2514+
CLOUD_BUILD_UNAVAILABLE = 1;
2515+
2516+
// The predeploy operation did not complete successfully; check Cloud Build
2517+
// logs.
2518+
EXECUTION_FAILED = 2;
2519+
2520+
// The predeploy build did not complete within the alloted time.
2521+
DEADLINE_EXCEEDED = 3;
2522+
2523+
// Cloud Build failed to fulfill Cloud Deploy's request. See failure_message
2524+
// for additional details.
2525+
CLOUD_BUILD_REQUEST_FAILED = 4;
2526+
}
2527+
2528+
// Output only. The resource name of the Cloud Build `Build` object that is
2529+
// used to execute the custom actions associated with the predeploy Job.
2530+
// Format is projects/{project}/locations/{location}/builds/{build}.
2531+
string build = 1 [
2532+
(google.api.field_behavior) = OUTPUT_ONLY,
2533+
(google.api.resource_reference) = {
2534+
type: "cloudbuild.googleapis.com/Build"
2535+
}
2536+
];
2537+
2538+
// Output only. The reason the predeploy failed. This will always be
2539+
// unspecified while the predeploy is in progress or if it succeeded.
2540+
FailureCause failure_cause = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
2541+
2542+
// Output only. Additional information about the predeploy failure, if
2543+
// available.
2544+
string failure_message = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
2545+
}
2546+
2547+
// PostdeployJobRun contains information specific to a postdeploy `JobRun`.
2548+
message PostdeployJobRun {
2549+
// Well-known postdeploy failures.
2550+
enum FailureCause {
2551+
// No reason for failure is specified.
2552+
FAILURE_CAUSE_UNSPECIFIED = 0;
2553+
2554+
// Cloud Build is not available, either because it is not enabled or because
2555+
// Cloud Deploy has insufficient permissions. See [required
2556+
// permission](https://cloud.google.com/deploy/docs/cloud-deploy-service-account#required_permissions).
2557+
CLOUD_BUILD_UNAVAILABLE = 1;
2558+
2559+
// The postdeploy operation did not complete successfully; check Cloud Build
2560+
// logs.
2561+
EXECUTION_FAILED = 2;
2562+
2563+
// The postdeploy build did not complete within the alloted time.
2564+
DEADLINE_EXCEEDED = 3;
2565+
2566+
// Cloud Build failed to fulfill Cloud Deploy's request. See failure_message
2567+
// for additional details.
2568+
CLOUD_BUILD_REQUEST_FAILED = 4;
2569+
}
2570+
2571+
// Output only. The resource name of the Cloud Build `Build` object that is
2572+
// used to execute the custom actions associated with the postdeploy Job.
2573+
// Format is projects/{project}/locations/{location}/builds/{build}.
2574+
string build = 1 [
2575+
(google.api.field_behavior) = OUTPUT_ONLY,
2576+
(google.api.resource_reference) = {
2577+
type: "cloudbuild.googleapis.com/Build"
2578+
}
2579+
];
2580+
2581+
// Output only. The reason the postdeploy failed. This will always be
2582+
// unspecified while the postdeploy is in progress or if it succeeded.
2583+
FailureCause failure_cause = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
2584+
2585+
// Output only. Additional information about the postdeploy failure, if
2586+
// available.
2587+
string failure_message = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
2588+
}
2589+
24202590
// CreateChildRolloutJobRun contains information specific to a
24212591
// createChildRollout `JobRun`.
24222592
message CreateChildRolloutJobRun {

0 commit comments

Comments
 (0)