aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/assets/gcloud_linux/create.py
diff options
context:
space:
mode:
Diffstat (limited to 'infra/bots/assets/gcloud_linux/create.py')
-rwxr-xr-xinfra/bots/assets/gcloud_linux/create.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/infra/bots/assets/gcloud_linux/create.py b/infra/bots/assets/gcloud_linux/create.py
index a37374f462..2c66bb2c97 100755
--- a/infra/bots/assets/gcloud_linux/create.py
+++ b/infra/bots/assets/gcloud_linux/create.py
@@ -19,18 +19,31 @@ import subprocess
# scripting gcloud and also for updates.
BASE_URL = 'https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/%s'
GCLOUD_BASE_NAME='google-cloud-sdk'
-GCLOUD_ARCHIVE = '%s-191.0.0-linux-x86_64.tar.gz' % GCLOUD_BASE_NAME
+GCLOUD_ARCHIVE = '%s-200.0.0-linux-x86_64.tar.gz' % GCLOUD_BASE_NAME
GCLOUD_URL = BASE_URL % GCLOUD_ARCHIVE
def create_asset(target_dir):
"""Create the asset."""
+ target_dir = os.path.abspath(target_dir)
subprocess.check_call(['curl', GCLOUD_URL, '-o', GCLOUD_ARCHIVE])
# Extract the arcive to the target directory and remove it.
subprocess.check_call(['tar', '-xzf', GCLOUD_ARCHIVE,
'--strip-components=1',
'-C', target_dir])
- subprocess.check_call(['rm', GCLOUD_ARCHIVE])
+
+ # Substitute the HOME directory in the environment so we don't overwrite
+ # an existing gcloud configuration in $HOME/.config/gcloud
+ env = os.environ.copy()
+ env["HOME"] = target_dir
+ gcloud_exe = os.path.join(target_dir, 'bin', 'gcloud')
+ subprocess.check_call([gcloud_exe, 'components',
+ 'install', 'beta', 'cloud-datastore-emulator',
+ '--quiet'], env=env)
+ subprocess.check_call([gcloud_exe, 'components','update', '--quiet'], env=env)
+
+ # Remove the tarball.
+ os.remove(GCLOUD_ARCHIVE)
def main():
parser = argparse.ArgumentParser()