def get_production_builds_info(platform): """Gets the build information for production builds. Omits platforms containing digits, namely, win64. Omits channels containing underscore, namely, canary_asan. Platform is e.g. ANDROID, LINUX, MAC, WIN. """ builds_metadata = [] omahaproxy_platform = _convert_platform_to_omahaproxy_platform(platform) build_info = utils.fetch_url(BUILD_INFO_URL) if not build_info: logs.log_error('Failed to fetch build info from %s' % BUILD_INFO_URL) return [] for line in build_info.splitlines(): match = re.match(BUILD_INFO_PATTERN, line) if not match: continue platform_type = match.group(1) if platform_type != omahaproxy_platform: continue build_type = match.group(2) version = match.group(3) revision = match.group(4) builds_metadata.append( BuildInfo(platform, build_type, version, revision)) return builds_metadata
def _get_url_content(url): """Read a potentially base64-encoded resource from the given URL.""" if url.startswith(storage.GS_PREFIX): # Fetch a GCS path with authentication. url_content = storage.read_data(url) else: # Fetch a regular url without authentication. url_content = utils.fetch_url(url) # Urls on googlesource.com return file data as base64 encoded to avoid # cross-site scripting attacks. If the requested url contains |format=text|, # then the output is base64 encoded. So, decode it first. if url_content and url.endswith('format=text'): url_content = base64.b64decode(url_content) return url_content
def _fetch_releases_from_chromiumdash(platform): """Makes a Call to chromiumdash's fetch_releases api, and returns its json array response.""" chromiumdash_platform = _convert_platform_to_chromiumdash_platform(platform) query_url = BUILD_INFO_URL_CD.format(platform=chromiumdash_platform) build_info = utils.fetch_url(query_url) if not build_info: logs.log_error('Failed to fetch build info from %s' % query_url) return [] try: build_info_json = json.loads(build_info) if not build_info_json: logs.log_error('Empty response from %s' % query_url) return [] except Exception: logs.log_error('Malformed response from %s' % query_url) return [] return build_info_json