This document describes how to verify a Cloud Deploy deployment.
You can configure Cloud Deploy to verify that an application that you have deployed to any target is working correctly. Verification is done using your own testing image or images, and you configure Cloud Deploy to run those tests after deployment finishes.
How does deployment verification work?
You configure one or more targets in your delivery pipeline for deployment verification by defining tasks to run.
After an application is deployed, Cloud Deploy runs the verify tasks in the Cloud Deploy execution environment.
Success or failure of the tests executed indicates success or failure of the verification:
Verification success is determined by the exit code generated by the container.
0indicates success. A non-zero exit code indicates failure. To generate the expected verification result, make sure the container exits with the appropriate exit code. If more than one container is executed as part of verification, they must all succeed for verification to succeed.If the verification fails, the rollout also fails.
If a deployment fails during verification, you can see that by inspecting the rollout:

You can ignore or retry a failed verification.
You can also terminate an in-progress verify job.
Components used for verification
The rollout resource includes the following objects, which support deployment verification:
Phase
The collection of operations (jobs) in a rollout that are logically grouped together, for example a deploy or a deploy and verify.
Job
The specific operation to be performed on a rollout, such as deploy or verify.
Job run
A child of the rollout resource, the job run is an instance of a job, for example an attempt to deploy.
For more about Cloud Deploy resources, see Cloud Deploy service architecture
Configure Cloud Deploy for deployment verification
Enabling deployment verification for a Cloud Deploy target consists
of adding a verify stanza to a given target (or targets) in a delivery
pipeline progression, as shown in this example:
apiVersion: deploy.cloud.google.com/v1
kind: DeliveryPipeline
metadata:
name: my-demo-app
description: main application pipeline
serialPipeline:
stages:
- targetId: dev
profiles: []
strategy:
standard:
verify:
tasks:
- type: container
image: "VERIFY_IMAGE"
command: [COMMANDS_TO_RUN]
args: [LIST_OF_ARGS]
env: {VERIFY_TASK_ENV_MAP}
In this YAML:
VERIFY_IMAGE
Is the name of the image you want to run for the verify job. For example,
us-central1-docker.pkg.dev/gcp-project-id-12345/my-repository/my-app:v1.2for an Artifact Registry image.COMMANDS_TO_RUN
Is a list of entrypoints to run on that container.
"/bin/sh"is a typical command to specify here, to invoke a shell.LIST_OF_ARGS
Is a list of arguments to provide to the command. This is a comma-separated list, with each argument in quotation marks. If your COMMAND_TO_RUN is
"/bin/sh", then one of the arguments here would be"-c", and another argument would be the entire command you want to run in the shell you're invoking.Here's an example:
command: ["/bin/sh"] args: ["-c", `echo "This command ran!"`]VERIFY_TASK_ENV_MAP
Is a map of environment variables passed into the container, in the format
KEY:VAL.
The verify operation is executed within its own execution environment. This execution environment can
be configured for VERIFY the same as it can be for RENDER and DEPLOY.
Run verification on the application cluster
By default, deployment verification runs in the Cloud Deploy execution environment. You can also configure Skaffold to run verification on the same cluster where your application is running.
To run your verification containers on the cluster, you must configure the verification
containers under the verify stanza in your skaffold.yaml. For each container
defined, you must also set executionMode.kubernetesCluster.
verify:
- name:
container:
name:
image:
command:
args:
executionMode:
kubernetesCluster:
The following is an example verify stanza that includes executionMode to invoke the verification container on the application cluster:
verify:
- name: integration-test-container
container:
name: integration-test-container
image: integration-test-container