make buildbot_globals.py read global_variables.json file from googlesource
BUG=skia:2564
NOTRY=True
R=borenet@google.com
Author: epoger@google.com
Review URL: https://codereview.chromium.org/291563008
git-svn-id: http://skia.googlecode.com/svn/trunk@14770 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/buildbot_globals.py b/tools/buildbot_globals.py
index 341cc36..1dd7819 100755
--- a/tools/buildbot_globals.py
+++ b/tools/buildbot_globals.py
@@ -12,6 +12,7 @@
from contextlib import closing
import HTMLParser
+import base64
import json
import re
import svn
@@ -22,8 +23,9 @@
_global_vars = None
-GLOBAL_VARS_JSON_URL = ('http://skia-tree-status.appspot.com/repo-serving/'
- 'buildbot/site_config/global_variables.json')
+_GLOBAL_VARS_JSON_BASE64_URL = (
+ 'https://skia.googlesource.com/buildbot/+/master/'
+ 'site_config/global_variables.json?format=TEXT')
class GlobalVarsRetrievalError(Exception):
@@ -46,21 +48,9 @@
pass
-def retrieve_from_mirror(url):
- """Retrieve the given file from the Skia Buildbot repo mirror.
-
- Args:
- url: string; the URL of the file to retrieve.
- Returns:
- The contents of the file in the repository.
- """
- with closing(urllib2.urlopen(url)) as f:
- return f.read()
-
-
def Get(var_name):
"""Return the value associated with this name in global_variables.json.
-
+
Args:
var_name: string; the variable to look up.
Returns:
@@ -71,10 +61,11 @@
global _global_vars
if not _global_vars:
try:
- global_vars_text = retrieve_from_mirror(GLOBAL_VARS_JSON_URL)
+ with closing(urllib2.urlopen(_GLOBAL_VARS_JSON_BASE64_URL)) as f:
+ global_vars_text = base64.b64decode(f.read())
except Exception as e:
raise GlobalVarsRetrievalError('Failed to retrieve %s:\n%s' %
- (GLOBAL_VARS_JSON_URL, str(e)))
+ (_GLOBAL_VARS_JSON_BASE64_URL, str(e)))
try:
_global_vars = json.loads(global_vars_text)
except ValueError as e: