aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/assets/scripts/create_and_upload.py
diff options
context:
space:
mode:
authorGravatar borenet <borenet@chromium.org>2016-06-15 12:07:42 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-15 12:07:42 -0700
commit0f1469bcdad11cf8bfe79ace33d28052418ecb48 (patch)
tree5411db3cc9fecf963821f2d5a904565617d25ed0 /infra/bots/assets/scripts/create_and_upload.py
parent115e925dc85f3c6dbb140a2c1be3309ff72d3d8b (diff)
Add asset management scripts
These provide an easy way to create assets to be used by bots, eg. Android SDK. To create an asset: $ infra/bots/assets/assets.py add android_sdk (adds scripts in infra/bots/assets/android_sdk) To upload a new version of an asset: $ infra/bots/assets/android_sdk/upload.py -t $ANDROID_SDK_ROOT (uploads Android SDK to GS, writes a version file) $ git commit $ git cl upload To download the current version of the asset: $ infra/bots/assets/android_sdk/download.py -t ../tmp BUG=skia:5427 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2069543002 Review-Url: https://codereview.chromium.org/2069543002
Diffstat (limited to 'infra/bots/assets/scripts/create_and_upload.py')
-rwxr-xr-xinfra/bots/assets/scripts/create_and_upload.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/infra/bots/assets/scripts/create_and_upload.py b/infra/bots/assets/scripts/create_and_upload.py
new file mode 100755
index 0000000000..1356447477
--- /dev/null
+++ b/infra/bots/assets/scripts/create_and_upload.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#
+# Copyright 2016 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()