Get started with Google Cloud SDK and Travis fast

Share this :
Share this :

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:

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 montana@travis-ci.org and I will assist you.

Happy building!

© Copyright 2024, All Rights Reserved