aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/assets
diff options
context:
space:
mode:
authorGravatar Stephan Altmueller <stephana@google.com>2018-03-07 14:44:44 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-07 20:44:50 +0000
commit88df8d2e5a87df5605b1d5530408cc6f534d8feb (patch)
tree669d656f7b14912c621cfb6b5813e4c7092ffbb1 /infra/bots/assets
parent5183e649efdcf4bf46a2883fdedec7a3b7e4fb0f (diff)
Test SKQP on Firebase Testlab and Upload
- adds building the testlab driver (run_testlab) as a separate step - adds gcloud isolate necessary to run testlab - adds Testlab support and uploading a verified AKP to GCS (with meta data attached). Bug: skia: Change-Id: I1bf265f46c99360eb3a9eb684886f93de48085fe Reviewed-on: https://skia-review.googlesource.com/111603 Reviewed-by: Eric Boren <borenet@google.com> Reviewed-by: Ben Wagner <benjaminwagner@google.com> Commit-Queue: Stephan Altmueller <stephana@google.com>
Diffstat (limited to 'infra/bots/assets')
-rw-r--r--infra/bots/assets/gcloud_linux/VERSION1
-rwxr-xr-xinfra/bots/assets/gcloud_linux/common.py26
-rwxr-xr-xinfra/bots/assets/gcloud_linux/create.py42
-rwxr-xr-xinfra/bots/assets/gcloud_linux/create_and_upload.py41
-rwxr-xr-xinfra/bots/assets/gcloud_linux/download.py16
-rwxr-xr-xinfra/bots/assets/gcloud_linux/upload.py16
6 files changed, 142 insertions, 0 deletions
diff --git a/infra/bots/assets/gcloud_linux/VERSION b/infra/bots/assets/gcloud_linux/VERSION
new file mode 100644
index 0000000000..62f9457511
--- /dev/null
+++ b/infra/bots/assets/gcloud_linux/VERSION
@@ -0,0 +1 @@
+6 \ No newline at end of file
diff --git a/infra/bots/assets/gcloud_linux/common.py b/infra/bots/assets/gcloud_linux/common.py
new file mode 100755
index 0000000000..caa0ad899c
--- /dev/null
+++ b/infra/bots/assets/gcloud_linux/common.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""Common vars used by scripts in this directory."""
+
+
+import os
+import sys
+
+FILE_DIR = os.path.dirname(os.path.abspath(__file__))
+INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir))
+
+sys.path.insert(0, INFRA_BOTS_DIR)
+from assets import assets
+
+ASSET_NAME = os.path.basename(FILE_DIR)
+
+
+def run(cmd):
+ """Run a command, eg. "upload" or "download". """
+ assets.main([cmd, ASSET_NAME] + sys.argv[1:])
diff --git a/infra/bots/assets/gcloud_linux/create.py b/infra/bots/assets/gcloud_linux/create.py
new file mode 100755
index 0000000000..a37374f462
--- /dev/null
+++ b/infra/bots/assets/gcloud_linux/create.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""Create the asset."""
+
+
+import argparse
+import glob
+import os
+import shutil
+import subprocess
+
+# See https://cloud.google.com/sdk/downloads#versioned for documentation on
+# 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_URL = BASE_URL % GCLOUD_ARCHIVE
+
+def create_asset(target_dir):
+ """Create the asset."""
+ 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])
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--target_dir', '-t', required=True)
+ args = parser.parse_args()
+ create_asset(args.target_dir)
+
+if __name__ == '__main__':
+ main()
diff --git a/infra/bots/assets/gcloud_linux/create_and_upload.py b/infra/bots/assets/gcloud_linux/create_and_upload.py
new file mode 100755
index 0000000000..cc81ec5c00
--- /dev/null
+++ b/infra/bots/assets/gcloud_linux/create_and_upload.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""Create the asset and upload it."""
+
+
+import argparse
+import common
+import os
+import subprocess
+import sys
+import utils
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--gsutil')
+ args = parser.parse_args()
+
+ with utils.tmp_dir():
+ cwd = os.getcwd()
+ 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]
+ if args.gsutil:
+ cmd.extend(['--gsutil', args.gsutil])
+ subprocess.check_call(cmd)
+ except subprocess.CalledProcessError:
+ # Trap exceptions to avoid printing two stacktraces.
+ sys.exit(1)
+
+if __name__ == '__main__':
+ main()
diff --git a/infra/bots/assets/gcloud_linux/download.py b/infra/bots/assets/gcloud_linux/download.py
new file mode 100755
index 0000000000..ca999e0378
--- /dev/null
+++ b/infra/bots/assets/gcloud_linux/download.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""Download the current version of the asset."""
+
+
+import common
+
+
+if __name__ == '__main__':
+ common.run('download')
diff --git a/infra/bots/assets/gcloud_linux/upload.py b/infra/bots/assets/gcloud_linux/upload.py
new file mode 100755
index 0000000000..bdfbda783e
--- /dev/null
+++ b/infra/bots/assets/gcloud_linux/upload.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""Upload a new version of the asset."""
+
+
+import common
+
+
+if __name__ == '__main__':
+ common.run('upload')