Get started with Google Cloud SDK and Travis fast

By

Jul 29, 2022

Contents

In the spirit of being fast, this tutorial will be as fast as the implementation and usage itself. Let’s get to it, running Google Cloud SDK, Docker and Kubectl. Let’s get started.

The .travis.yml

Here’s a template .travis.yml I’ve made, you can make this into a bash script to make this process more streamlined:

dist: jammy 
cache:
  directories:
  - $HOME/google-cloud-sdk
services:
- docker
env:
  global:
  - CLOUDSDK_CORE_DISABLE_PROMPTS=1 
before_install:
- if [ ! -d $HOME/google-cloud-sdk/bin ]; then
    rm -rf $HOME/google-cloud-sdk;
    curl https://sdk.cloud.google.com | bash > /dev/null;
  fi
- source $HOME/google-cloud-sdk/path.bash.inc
- gcloud components update kubectl
- gcloud version
install: true
script: true

You’ll notice curl will pull all the things you need from Google, then we run gcloud components update kubectl, and we make sure we Docker listed as a service. Your build should look similar to this:

181833484 d5193c31 1298 4983 b83f 50ac924e2e65 1

All done!

Conclusion

You now have a great template to get gcloud setup quickly with Docker and Kubectl.

As always, if you have any questions about this tutorial, please email me at [email protected] and I will assist you.

Happy building!

Written By

Reviewed By