aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots
diff options
context:
space:
mode:
Diffstat (limited to 'infra/bots')
-rw-r--r--infra/bots/assets/gcloud_linux/VERSION2
-rwxr-xr-xinfra/bots/assets/gcloud_linux/create.py17
-rwxr-xr-xinfra/bots/assets/gcloud_linux/create_and_upload.py7
3 files changed, 21 insertions, 5 deletions
diff --git a/infra/bots/assets/gcloud_linux/VERSION b/infra/bots/assets/gcloud_linux/VERSION
index 62f9457511..9a037142aa 100644
--- a/infra/bots/assets/gcloud_linux/VERSION
+++ b/infra/bots/assets/gcloud_linux/VERSION
@@ -1 +1 @@
-6 \ No newline at end of file
+10 \ No newline at end of file
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()
diff --git a/infra/bots/assets/gcloud_linux/create_and_upload.py b/infra/bots/assets/gcloud_linux/create_and_upload.py
index cc81ec5c00..92b5a3105e 100755
--- a/infra/bots/assets/gcloud_linux/create_and_upload.py
+++ b/infra/bots/assets/gcloud_linux/create_and_upload.py
@@ -11,6 +11,7 @@
import argparse
import common
+import shutil
import os
import subprocess
import sys
@@ -24,12 +25,14 @@ def main():
with utils.tmp_dir():
cwd = os.getcwd()
+ workdir = os.path.join(cwd, "workdir")
create_script = os.path.join(common.FILE_DIR, 'create.py')
upload_script = os.path.join(common.FILE_DIR, 'upload.py')
try:
- subprocess.check_call(['python', create_script, '-t', cwd])
- cmd = ['python', upload_script, '-t', cwd]
+ os.mkdir(workdir)
+ subprocess.check_call(['python', create_script, '-t', workdir])
+ cmd = ['python', upload_script, '-t', workdir]
if args.gsutil:
cmd.extend(['--gsutil', args.gsutil])
subprocess.check_call(cmd)