Google has added deployment verification capabilities to its Google Cloud Deploy tool. This new feature is in preview release and makes use of recent updates to Skaffold. Along with this announcement, Google has also added support for Cloud Run to Google Cloud Deploy.
The new deployment verification step allows for using any process that runs in a container to verify the state of the application being deployed. For example, curl
could be used to call routes on the application to verify its health. As with the render
and deploy
operations, deployment verification is performed within its own execution environment. This allows for custom configurations for verification using specific worker pools or services accounts.
This feature is enabled through the new verify
command introduced in Skaffold 2.0. Skaffold is an open-sourced command line deployment tool that underpins Cloud Deploy.
Enabling deployment verification requires a few steps. First Skaffold should be configured for verification. This identifies the container image to use to run the tests and any commands to run from that image. The example below defines two images to perform both integration tests and endpoint verification:
apiVersion: skaffold/v3alpha1
kind: Config
build:
artifacts:
- image: integration-test
context: integration-test
manifests:
rawYaml:
- kubernetes.yaml
deploy:
kubectl: {}
verify:
- name: verify-integration-test
container:
name: integration-test
image: integration-test
command: ["./test-systems.sh"]
- name: verify-endpoint-test
container:
name: alpine
image: alpine
command: ["/bin/sh"]
args: ["-c", "wget $ENDPOINT_URL"]
The next step involves configuring one or more targets in the delivery pipeline for verification. Note that a verify: false
is equivalent to not specifying the verify
property:
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: true
- targetId: prod
profiles: []
strategy:
standard:
verify: false
Once the rollout is deployed, Google Cloud Deploy will run the Skaffold verify
command, invoking the tests detailed in the verify
stanza of the skaffold.yml
configuration file. If any of the tests fail, the entire deployment run fails. It is possible to re-run just the deployment portion if needed.
Cloud Run is Google Cloud Platform's managed serverless container runtime. Available as a preview feature, delivery pipelines can now specify and deploy to Cloud Run targets. This new capability provides all the existing Google Cloud Deploy features including rollback, approval, auditing, and delivery metrics. It also includes the new deployment verification feature.
Similar to the new verify phase, support for Cloud Run is enabled via new features within Skaffold. The 2.0 beta 2 release of Skaffold adds support for deploying Cloud Run services.
The Google Cloud Deploy tutorials page has been updated to include using deployment verification. More information about these releases can be found on the Google Cloud blog and within the Google Cloud Deploy documentation.