Google Cloud Deploy introduces post deployment verification
Alvaro Huanca
Developer Relations Engineer
Wilgner Garcia
Cloud Customer Engineer
Google Cloud Deploy introduces post deployment verification
Google Cloud Deploy is introducing a new feature called deployment verification, with this feature developers and operators will be able to orchestrate and execute post deployment testing without having to undertake a more extensive testing integration, like through using Cloud Deploy notifications or manually testing.
The 2021 State of DevOps report showed us that continuous testing is a strong predictor of successful continuous delivery. By incorporating early and frequent testing throughout the delivery process, with testers working alongside developers throughout, teams can iterate and make changes to their product, service, or application more quickly.
What about performing post delivery testing, to determine if certain conditions are met to further validate a deployment? For most, the ability to run these tests remains critical to their business and is an oft desired table stakes capability from a continuous delivery tool.
As shared in our previous post this past August, Cloud Deploy uses Skaffold for render and deploy operations. This new feature relies on a new Skaffold phase named ‘verify’, this phase allows developers and operators to add a list of test containers to be run post deployment and monitored for success/failure.
How to use
We are going to use the python-hello-world from Cloud Code Samples to show how deployment verification works. With our Cloud Build trigger and file configured and Cloud Deploy Pipeline created, we can start to try the post deployment verification feature.
First, we need to modify the skaffold.yaml to insert the new verify phase:
The possibility to use any container image (either standalone containers or built by Skaffold) gives developers the flexibility to perform simple tests up to more complex scenarios. For this case we are going to use ‘wget’ to check if the “/hello” page exists and if it's up (http 200 response).
Although we can use Kubernetes readiness probe to check if our application/pod is ready to receive requests, this new Cloud Deploy feature allows us to perform controlled and pre-defined tests. We can check application metrics and/or execute integration tests, for example.
Now let's take a look at our clouddeploy.yaml. The post deployment verification can be used for different targets based on different Skaffold profiles, in our case the ‘dev’ target, also we need to configure the targets we want to have deployment verification, as highlighted below.
This new strategy configuration allows for potential additional Cloud Deploy deployment strategies in the future, for now we are going to use the standard one.
After these changes, we can trigger our CI/CD process using ‘gcloud builds submit’ or pushing the code to the source repo in order to trigger Cloud Build. After the build phase (also known as Continuous Integration) Cloud Build will create a Google Cloud Deploy release and deploy it through the specified delivery pipeline onto our 'dev' target.
Important: Like Cloud Deploy rendering and deployment, the verification container runs on Cloud Build secure and hosted environment, and not in the same environment of your application, so you need to expose the application to execute the post deployment verification, or you can use Cloud Build Private pools.
To check the deployment status, open Cloud Deploy then navigate to the delivery pipeline and click on the last release in the release list. On the release details page, select the last rollout from the rollout list.
The above screenshot shows the post deployment verification was successful. You can click on verification logs to see the details. If we change the address of our ‘wget’ verification on skaffold.yaml and re-run the process, we can see what happens when the verification fails.
When the deployment verification fails, the rollout should also fail.
All the deployment verification tests have to pass. If any deployment verification test fails the rollout also fails. However, it’s possible to re-run post deployment verification for a failed rollout. Also it’s possible to receive a Pub/Sub notification when a verification is started and completed.Try yourself!
The Google Cloud Deploy tutorials page has been updated with a deployment verification walkthrough. This interactive tutorial will take you through the steps to set up and use the Google Cloud Deploy service. This pipeline includes automated deployment verification, which runs checks at each stage to test whether the application has been successfully deployed.
The Future
Comprehensive, easy-to-use, and cost-effective DevOps tools are key to building an efficient software development team, and it’s our hope that Google Cloud Deploy will help you implement complete CI/CD pipelines. And we’re just getting started! Stay tuned as we introduce exciting new capabilities and features to Google Cloud Deploy in the months to come.
In the meantime, check out the product page, documentation, quickstart, and tutorials. Finally, If you have feedback on Google Cloud Deploy, you can join the conversation. We look forward to hearing from you!