Automate gcloud component updates

How can I programmatically update gcloud components in a shell script?

Calling gcloud components update requires a user entry, for example:

 $ gcloud components update The following components will be installed: -------------------------------------------- | kubectl (Linux, x86_64) | 1.0.1 | 4.5 MB | -------------------------------------------- For the latest release notes, please visit: https://dl.google.com/dl/cloudsdk/release/RELEASE_NOTES Do you want to continue (Y/n)? 

I cannot find the gcloud argument to provide the update.

+6
source share
1 answer

You are looking for the --quiet flag.

From gcloud --help :

  --quiet, -q Disable all interactive prompts when running gcloud commands. If input is required, defaults will be used, or an error will be raised. 

This is usually the flag that you want to use for non-interactive contexts.

You can also set the CLOUDSDK_CORE_DISABLE_PROMPTS environment CLOUDSDK_CORE_DISABLE_PROMPTS for a non-empty value:

 export CLOUDSDK_CORE_DISABLE_PROMPTS=1 gcloud components update # This works for all gcloud commands 
+11
source

All Articles