aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra
diff options
context:
space:
mode:
authorGravatar Stephan Altmueller <stephana@google.com>2018-05-07 10:23:42 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-07 15:46:40 +0000
commitbeca17255432d7e9502f94a85c4477a237730798 (patch)
treead966bd04cf782a63e516b602d9c736b5359174c /infra
parent0ca7a88e64500df906b6c24e99a81c40848725a2 (diff)
Add datastore emulator to gcloud asset
Bug: skia: Change-Id: I2f0986e0ae3057e0a7fca479c0f3e062f10c3eba Reviewed-on: https://skia-review.googlesource.com/126205 Commit-Queue: Stephan Altmueller <stephana@google.com> Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Diffstat (limited to 'infra')
-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)