diff options
author | Mike Aizatsky <mike.aizatsky@gmail.com> | 2016-12-27 11:36:13 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-27 11:36:13 -0800 |
commit | 3c9642ebe40da67c89e85c1d4a397e3d23d99d21 (patch) | |
tree | 84d1fdaf804e4733ba4ef8f84f094813e8909d26 | |
parent | 15fcfa0e52ea0c2bf1cb63511fbd3c353316602f (diff) |
[infra] uploading status.json
-rwxr-xr-x | infra/auto-setup/build_status.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/infra/auto-setup/build_status.py b/infra/auto-setup/build_status.py index c54abf85..e53ffb0e 100755 --- a/infra/auto-setup/build_status.py +++ b/infra/auto-setup/build_status.py @@ -2,6 +2,7 @@ import codecs import datetime +import json import os import subprocess import sys @@ -61,15 +62,26 @@ def upload_status(successes, failures): """Upload main status page.""" env = Environment(loader=FileSystemLoader(os.path.join(SCRIPT_DIR, 'templates'))) + data = { + 'projects': failures + successes, + 'failures': failures, + 'successes': successes, + 'last_updated': datetime.datetime.utcnow().ctime() + } + with open('status.html', 'w') as f: f.write( - env.get_template('status_template.html').render( - failures=failures, successes=successes, - last_updated=datetime.datetime.utcnow().ctime())) + env.get_template('status_template.html').render(data)) subprocess.check_output(['gsutil', 'cp', 'status.html', 'gs://' + LOGS_BUCKET], stderr=subprocess.STDOUT) + with open('status.json', 'w') as f: + f.write(json.dumps(data)) + + subprocess.check_output(['gsutil', 'cp', 'status.json', 'gs://' + + LOGS_BUCKET], stderr=subprocess.STDOUT) + def upload_build_logs(successes, failures): """Upload individual build logs.""" |