I love Google Cloud Platform. I love Google Kubernetes Engine. And I love GitHub as well. But I need a quick CD pipeline for an easy automated app deployment. Setting up the whole Jenkins CI or using some paid Pipeline as a service takes too much time, energy and money. Here comes the Google Cloud Builder (currently beta).

I have an easy stateless php app running on nginx and php-fpm in Docker containers versioned in git on GitHub. And I need is to deploy it quickly and cheap to GKE.

Open up Build triggers. It should be in Google console — Tools — Container Registry — Build triggers (but, you know, they change the UI like every week, so it might be somewhere else)

Link your GitHub account with GCP

Import your repo

Set the trigger

Choose the cloudbuild.yaml where you can define your CI/CD pipeline as a code.

It is ugly, I know. I needed a fast solution, not a pretty one.

I need to build two Docker images, from different Dockerfiles, push them to Google Container Registry, template kubernetes deployment manifests, deploy them on GKE (kubectl apply) and create an ingress resource for external http traffic.

After I push to the repo, the build is automatically started

I see the git commit and action which caused the trigger, pipeline steps, time they took, total time of the build, link to images in GCR. And log:

All is immutable, I can easily rollback deployment to a tagged image with a commit id from git. I can Rebuild the build in Build history. Ingress DNS records are pushed to CloudFlare automatically.

I had to create my own deployment/service/ingress/whatever kubernetes manifests and had to template them with sed (which is super ugly and the syntax won’t always work). Google Cloud Builder is in beta and there is definitely a lot to improve. Templating and GKE integration would be nice (manual kubectl apply, srsly?) to have. As well as deployment strategy selection and easier provisioning maybe? If you are looking for a similar, more-mature service, check out https://www.shippable.com/.

Check the source repo: https://github.com/bartimar/gke-test

EDIT: Check this amazing github repo of the one and only Kelsey Hightower with great tutorials on Google Cloud Builder https://github.com/kelseyhightower/pipeline