1
---
2
name: google-cicd-release-orchestration
3
metadata:
4
version: "1.0.1"
5
category: DevOps
6
description: >-
7
Use this skill when you need to design Cloud Deploy delivery pipelines or manage releases for applications deploying to Cloud Run or Google Kubernetes Engine (GKE). This skill encodes best practices for multi-environment deployment, deployment strategies (like canary), and release management (including rollbacks and automations). Always activate this skill for these tasks to ensure robust and consistent configuration.
8
DO NOT use for single-step direct deployments to Cloud Storage, Cloud Run, or GKE without Cloud Deploy (use `google-cicd-deploy`), end-to-end CI/CD source-to-build trigger architecture design (use `google-cicd-pipeline-design`), or Terraform HCL infrastructure provisioning (use `google-cicd-terraform`).
9
---
10
11
# Cloud Deploy Pipelines
12
13
## Usage Attribution
14
15
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
16
MUST read and follow the instructions in
17
[Usage Attribution](references/attribution.md).
18
19
## Overview
20
21
This skill encompasses the entire lifecycle of Cloud Deploy for a user, from
22
designing and creating delivery pipelines to managing releases and debugging
23
release failures.
24
25
**All** Workflows require the `clouddeploy.googleapis.com` API to be enabled.
26
27
## Prerequisites
28
29
Ensure the following prerequisites are satisfied before executing live commands
30
(auto-populated values from `deployment-config.json` take precedence):
31
32
* **CLI & Billing**: Install the
33
[Google Cloud SDK](https://docs.cloud.google.com/sdk/docs/install-sdk.md.txt)
34
(`gcloud`, `skaffold`, plus `kubectl` for GKE) and attach an active
35
**billing account** to the target project.
36
* **Authentication & Project**: Authenticate via `gcloud auth login` and
37
`gcloud auth application-default login` (or set
38
`GOOGLE_APPLICATION_CREDENTIALS`), then set the project and region (e.g.,
39
`us-central1`; see
40
[Cloud Locations](https://cloud.google.com/about/locations)):
41
`gcloud config set project <PROJECT_ID>` and
42
`gcloud config set compute/region <REGION>`.
43
* **API Enablement & IAM**: Enable required APIs (with user confirmation) via
44
`gcloud services enable clouddeploy.googleapis.com cloudbuild.googleapis.com
45
artifactregistry.googleapis.com run.googleapis.com container.googleapis.com
46
monitoring.googleapis.com`, and verify target IAM roles per
47
[iam-permissions.md](references/iam-permissions.md).
48
49
## Workflow: Designing a Pipeline
50
51
This workflow provides steps for designing a Cloud Deploy `DeliveryPipeline`.
52
53
### Constraints & Rules
54
55
1. **NO PLACEHOLDERS**: Never generate YAML with placeholders like
56
`<PROJECT_ID>`. Ask the user for values first.
57
2. **Context First**: Always check existing files and conversation context
58
before asking.
59
3. **Step-by-Step**: Perform the steps one at a time. The goal is to guide the
60
user through designing a delivery pipeline.
61
62
### Step 0: Prerequisites
63
64
**Required Context**: Before generating ANY configuration for this workflow,
65
first check `.gcp-deploy/deployment-config.json` (pulled from the organization's
66
source control config repository—**GitHub**, **GitLab**, **Bitbucket**, or any
67
Git provider—per
68
[how_to_load_deployment_config.md](references/how_to_load_deployment_config.md)
69
and [sample-deployment-config.json](references/sample-deployment-config.json))
70
and local `gcp-deploy.json` to automatically populate the values below. Ask the
71
user strictly for any information still missing:
72
73
- **Project ID**: The Google Cloud project ID for the Cloud Deploy resources.
74
- **Region**: The region for the Cloud Deploy resources (e.g., `us-central1`).
75
- **Application Name**: The name of the application that will be deployed. Use
76
the application name to generate the names of the Cloud Deploy resources,
77
such as `DeliveryPipeline` and `Target` resources.
78
- **Runtime**: Either Cloud Run or Google Kubernetes Engine (GKE).
79
- **If Cloud Run**: The Cloud Run project and location.
80
- **If GKE**: The GKE cluster name.
81
82
### Step 1: Define the target environments
83
84
1. Identify the number of deployment environments (e.g., dev, staging,
85
production).
86
2. Identify if promotions should require user approval.
87
3. Define each of the deployment environments as Cloud Deploy `Target`
88
resources in a `clouddeploy.yaml` file.
89
- Use [configure-targets.md](references/configure-targets.md) as a
90
reference when generating the resource YAML.
91
- Always prefix target IDs with the application name provided by the user
92
(e.g., `[app-name]-[env]`) to prevent resource name collisions when
93
multiple applications are deployed to different environments. For
94
example, if the user wants to deploy an application named "hello-world"
95
to test and prod environments, then use "hello-world-test" and
96
"hello-world-prod" as the `Target` IDs.
97
98
### Step 2: Define the delivery pipeline
99
100
1. Identify whether the user wants to use a canary deployment strategy for any
101
of the target environments.
102
2. Define the Cloud Deploy `DeliveryPipeline` in the `clouddeploy.yaml` file.
103
- Use [configure-pipelines.md](references/configure-pipelines.md) as a
104
reference when generating the resource YAML.
105
- Use application name as the `DeliveryPipeline` ID.
106
107
### Step 3: Define automations
108
109
1. Identify whether the user wants to automatically rollback if any failures
110
occur during the rollout.
111
2. **If the user specified multiple deployment environments in the previous
112
step**
113
- Identify if they want automatic promotions between deployment
114
environments.
115
3. **If the user specified a canary deployment strategy in the previous step**
116
- Identify if they want to automatically advance the rollout through the
117
phases after a wait period.
118
4. Define the Cloud Deploy `Automation` resources in the `clouddeploy.yaml`
119
file.
120
- Use [configure-automations.md](references/configure-automations.md) as a
121
reference when generating the resource YAML.
122
123
### Step 4: Validate the clouddeploy.yaml file
124
125
Ensure that the `clouddeploy.yaml` file is valid. See
126
https://docs.cloud.google.com/deploy/docs/config-files.md.txt for the schema.
127
128
### Step 5: Create the delivery pipeline
129
130
Run the following command to create the Cloud Deploy `DeliveryPipeline` and
131
associated resources, using the values collected in Step 0:
132
133
```bash
134
gcloud deploy apply --file=clouddeploy.yaml --region=<REGION> --project=<PROJECT_ID>
135
```
136
137
### Step 6: Create a skaffold.yaml file and runtime manifests
138
139
**Required Context**: Before generating a `skaffold.yaml` file, you **MUST**
140
know if the user has manifests for the runtime they are deploying to.
141
142
1. **If the user does not have runtime manifests**: Generate some basic ones
143
based on the runtime.
144
- **If Cloud Run**: Generate a Cloud Run manifest. Use
145
[basic-cloudrun-manifests.md](references/basic-cloudrun-manifests.md) as
146
a reference.
147
- **If GKE**: Generate a Kubernetes `Deployment` and `Service` manifest.
148
Use [basic-k8s-manifests.md](references/basic-k8s-manifests.md) as a
149
reference.
150
2. Create a `skaffold.yaml` file required to create a Cloud Deploy `Release`
151
for the `DeliveryPipeline`.
152
- Use [configure-skaffold.md](references/configure-skaffold.md) as a
153
reference when generating the `skaffold.yaml` file.
154
- **For multi-environment pipelines**: You must define a Skaffold profile
155
for each Cloud Deploy target environment, named to match the target ID
156
exactly. Do NOT use generic names like 'staging' or 'prod' for profile
157
names unless they match the target IDs.
158
159
### Step 7: Setup IAM permissions
160
161
Use [iam-permissions.md](references/iam-permissions.md) as a reference to set up
162
the necessary IAM permissions based on the `DeliveryPipeline` defined.
163
164
## Workflow: Add Google Observability Alert Policy Analysis to a Pipeline
165
166
Cloud Deploy integrates with Google Cloud Observability to provide metrics
167
analysis when deploying an application. When the application is deployed, Cloud
168
Deploy will monitor alert policies defined in Google Cloud Observability for any
169
incidents that were triggered after the application was deployed.
170
171
This feature can be used alongside automation to enable automatic rollbacks if
172
the application deployment triggers alert policies.
173
174
This section covers how to update the user's `DeliveryPipeline` to leverage this
175
feature.
176
177
### Constraints & Rules
178
179
A `DeliveryPipeline` MUST already be defined or being designed in the current
180
context.
181
182
### Step 0: Prerequisites
183
184
Cloud Deploy **requires** the Google Cloud Observability alerting policies to be
185
defined before they can be referenced in the `DeliveryPipeline`.
186
187
1. Prompt the user whether they have existing alerting policies defined for the
188
application. **DO NOT** assume that existing alerting policies are
189
applicable to the application being deployed.
190
2. If the user does not have alerting policies defined for the application,
191
help the user generate them.
192
- **If Cloud Run**: Use
193
[basic-cloudrun-alerts.md](references/basic-cloudrun-alerts.md) as a
194
reference.
195
196
### Step 1: Update the pipeline definition
197
198
1. Identify the duration for which the metrics analysis should run after the
199
application is deployed (e.g., 30 minutes).
200
2. Identify which alerting policies Cloud Deploy should monitor for incidents.
201
3. Update the `DeliveryPipeline` definition in the `clouddeploy.yaml` file to
202
include analysis configuration.
203
- Use [configure-pipelines.md](references/configure-pipelines.md) as a
204
reference when updating the `DeliveryPipeline` definition.
205
206
### Step 2: Validate the clouddeploy.yaml file
207
208
Ensure that the `clouddeploy.yaml` file is valid. See
209
https://docs.cloud.google.com/deploy/docs/config-files.md.txt for the schema.
210
211
### Step 3: Apply the pipeline changes
212
213
Run the following command to update the Cloud Deploy `DeliveryPipeline`:
214
215
```bash
216
gcloud deploy apply --file=clouddeploy.yaml --region=<REGION> --project=<PROJECT_ID>
217
```
218
219
### Step 4: Setup IAM permissions
220
221
Use [iam-permissions.md](references/iam-permissions.md) as a reference to set up
222
the necessary IAM permissions for analysis.
223
224
## Release Management
225
226
This section covers the various aspects of managing Cloud Deploy `Release`
227
resources.
228
229
### Constraints & Rules
230
231
In order to manage releases, a `DeliveryPipeline` MUST already be defined and
232
configured in Cloud Deploy. Determine whether a delivery pipeline is defined by
233
checking for a `clouddeploy.yaml` file and checking if the resources exist in
234
Cloud Deploy or ask the user directly.
235
236
**Required Context**:
237
238
- **Project ID**: The Google Cloud project ID of the `DeliveryPipeline`.
239
- **Region**: The region of the `DeliveryPipeline` (e.g., `us-central1`).
240
- **Delivery Pipeline ID**: The `DeliveryPipeline` ID.
241
242
### Create a release
243
244
**Use case**: The user wants to deploy a new version of their application.
245
246
**Required Context**: Before creating a `Release`, you **MUST** know whether the
247
users runtime manifests are using a placeholder for the container image and the
248
value of the placeholder. This is **CRITICAL** for build artifact substitution
249
in Cloud Deploy. Check the users runtime manifests or ask the user directly. See
250
examples in
251
[basic-cloudrun-manifests.md](references/basic-cloudrun-manifests.md) and
252
[basic-k8s-manifests.md](references/basic-k8s-manifests.md).
253
254
Run the following command to create a `Release` for the `DeliveryPipeline`:
255
256
```bash
257
gcloud deploy releases create release-$DATE-$TIME --delivery-pipeline=<DELIVERY_PIPELINE_ID> --region=<REGION> --project=<PROJECT_ID>
258
```
259
260
If the user is leveraging build artifact substitution with a placeholder in the
261
image field of the runtime manifests then use the `--images` flag:
262
263
```bash
264
gcloud deploy releases create release-$DATE-$TIME --delivery-pipeline=<DELIVERY_PIPELINE_ID> --region=<REGION> --project=<PROJECT_ID> --images <IMAGE_PLACEHOLDER>=<IMAGE_URI>
265
```
266
267
**CRITICAL**: If the `skaffold.yaml` is not in the current directory, use the
268
`--source` flag to specify the directory where the `skaffold.yaml` file is
269
located.
270
271
Reference documentation for `gcloud deploy releases create`:
272
https://docs.cloud.google.com/sdk/gcloud/reference/deploy/releases/create.
273
274
### Promote a release
275
276
**Use case**: The user wants to promote the application to the next target
277
environment in the `DeliveryPipeline` progression sequence.
278
279
Run the following command to promote a `Release` to the next target in the
280
`DeliveryPipeline` progression sequence:
281
282
```bash
283
gcloud deploy promote --release=<RELEASE_ID> --delivery-pipeline=<DELIVERY_PIPELINE_ID> --region=<REGION> --project=<PROJECT_ID>
284
```
285
286
**TIP**: Use a short <RELEASE_ID> since the command will auto-generate a
287
`Rollout` ID (with a 63 character limit) in the format:
288
`<RELEASE_ID>-to-<TARGET_ID>`.
289
290
Reference documentation for `gcloud deploy releases promote`:
291
https://docs.cloud.google.com/sdk/gcloud/reference/deploy/releases/promote.
292
293
### Monitor a release
294
295
**Use case**: Monitor the status of a release across a `DeliveryPipeline`.
296
297
Monitoring a release across a `DeliveryPipeline` consists of checking the status
298
of both the `Release` resource and its child `Rollout` resource(s). Always
299
ensure that the `Release` has completed successfully before checking the status
300
of the `Rollout`.
301
302
### Troubleshoot
303
304
#### Release failed
305
306
Get the release to determine which of the target renders failed and inspect the
307
failure message and failure cause. Additionally the target renders contain a
308
Cloud Build reference where the target render was executed. Retrieve the build
309
logs to determine the root cause of the failure.
310
311
#### Rollout failed
312
313
Get the rollout to determine which of the jobs failed and inspect the failure
314
message and failure cause. Additionally the `Rollout` contains a Cloud Build
315
reference where the failed job was executed. Retrieve the build logs to
316
determine the root cause of the failure.
317
318
* **Binary Authorization (`BinAuthz`) Failure Interpretation on Promotion to
319
Production**: If a rollout or promotion to `prod` fails because Binary
320
Authorization blocked the image (e.g., Cloud Run
321
`BinaryAuthorizationCheckFailed` or GKE
322
`imagepolicywebhook.image-policy.k8s.io` admission denial), automatically
323
inspect and interpret the Binary Authorization evaluation results for the
324
user:
325
326
1. Check Cloud Audit Logs for the exact BinAuthz denial reason:
327
328
```bash
329
gcloud logging read 'logName:"cloudaudit.googleapis.com%2Fpolicy" OR protoPayload.serviceName="binaryauthorization.googleapis.com" OR protoPayload.status.message:"Binary Authorization"' \
330
--project=<PROJECT_ID> --limit=10 --format=json --quiet
331
```
332
2. Inspect the active Binary Authorization policy and platform policies
333
(`gcloud container binauthz policy export --project=<PROJECT_ID>` and
334
`gcloud beta container binauthz policy list --platform=<cloudRun|gke>
335
--project=<PROJECT_ID>`), and if a platform policy is used, evaluate it
336
against the image digest (`gcloud beta container binauthz policy
337
evaluate <POLICY_ID> --platform=<cloudRun|gke> --project=<PROJECT_ID>
338
--image=<DIGEST_URI>`).
339
3. Cross-check existing attestations (`gcloud container binauthz
340
attestations list --artifact-url="https://<DIGEST_URI>"
341
--project=<PROJECT_ID>`) and Artifact Analysis provenance/vulnerability
342
findings (`gcloud artifacts docker images describe <DIGEST_URI>
343
--show-provenance --show-package-vulnerability --project=<PROJECT_ID>`).
344
4. Clearly explain which policy rule, missing attestation
345
(`<ATTESTOR_NAME>`), provenance check, or CVE severity threshold blocked
346
the promotion and provide actionable remediation steps.
347
348
## Resource Cleanup & Teardown
349
350
Cloud Deploy pipelines, staging Cloud Storage buckets, Cloud Build executions,
351
and target Cloud Run / GKE runtimes incur charges (an active billing account is
352
required even within free tiers; see
353
[Google Cloud Pricing](https://cloud.google.com/pricing)). Always obtain
354
explicit user confirmation before deleting resources:
355
356
* **Delivery Pipeline & Targets**: `gcloud deploy delete
357
--file=clouddeploy.yaml --force --region=<REGION> --project=<PROJECT_ID>`
358
(or `gcloud deploy delivery-pipelines delete <DELIVERY_PIPELINE_ID> --force
359
--region=<REGION> --project=<PROJECT_ID>`)
360
* **Alerting Policies**: `gcloud alpha monitoring policies delete <POLICY_ID>
361
--project=<PROJECT_ID>`
362