Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automate gcloud components update

Tags:

gcloud

How can I update the gcloud components programmatically within a shell script?

Calling gcloud components update requires an user entry, e.g.:

$ 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 can't find an argument for gcloud to enforce the update.

like image 201
Dag Avatar asked Aug 04 '15 13:08

Dag


1 Answers

You're 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 generally a flag you'll want for non-interactive contexts.

You may also set the CLOUDSDK_CORE_DISABLE_PROMPTS environment variable to a non-empty value:

export CLOUDSDK_CORE_DISABLE_PROMPTS=1
gcloud components update # This works for all gcloud commands
like image 141
Zachary Newman Avatar answered Sep 22 '22 05:09

Zachary Newman