diff options
Diffstat (limited to 'infra/cifuzz/filestore')
-rw-r--r-- | infra/cifuzz/filestore/__init__.py | 4 | ||||
-rw-r--r-- | infra/cifuzz/filestore/github_actions/__init__.py | 4 | ||||
-rw-r--r-- | infra/cifuzz/filestore/github_actions/github_api.py | 4 |
3 files changed, 11 insertions, 1 deletions
diff --git a/infra/cifuzz/filestore/__init__.py b/infra/cifuzz/filestore/__init__.py index 0acb4b9c..ab240c83 100644 --- a/infra/cifuzz/filestore/__init__.py +++ b/infra/cifuzz/filestore/__init__.py @@ -36,3 +36,7 @@ class BaseFilestore: def download_latest_build(self, name, dst_directory): """Downloads the latest build with |name| to |dst_directory|.""" raise NotImplementedError('Child class must implement method.') + + def download_coverage(self, dst_directory): + """Downloads the latest project coverage report.""" + raise NotImplementedError('Child class must implement method.') diff --git a/infra/cifuzz/filestore/github_actions/__init__.py b/infra/cifuzz/filestore/github_actions/__init__.py index fbcbb1d7..56d6c2b0 100644 --- a/infra/cifuzz/filestore/github_actions/__init__.py +++ b/infra/cifuzz/filestore/github_actions/__init__.py @@ -81,3 +81,7 @@ class GithubActionsFilestore(filestore.BaseFilestore): def download_latest_build(self, name, dst_directory): """Downloads latest build with name |name| to |dst_directory|.""" return self._download_artifact(name, dst_directory) + + def download_coverage(self, name, dst_directory): + """Downloads the latest project coverage report.""" + return self._download_artifact(name, dst_directory) diff --git a/infra/cifuzz/filestore/github_actions/github_api.py b/infra/cifuzz/filestore/github_actions/github_api.py index 32e1b392..7d186b40 100644 --- a/infra/cifuzz/filestore/github_actions/github_api.py +++ b/infra/cifuzz/filestore/github_actions/github_api.py @@ -20,6 +20,8 @@ import sys import requests +import filestore + # pylint: disable=wrong-import-position,import-error sys.path.append( @@ -68,11 +70,11 @@ def _get_items(url, headers): params = {'per_page': _MAX_ITEMS_PER_PAGE, 'page': str(page_counter)} response = _do_get_request(url, params=params, headers=headers) response_json = response.json() - if not response.status_code == 200: # Check that request was successful. logging.error('Request to %s failed. Code: %d. Response: %s', response.request.url, response.status_code, response_json) + raise filestore.FilestoreError('Github API request failed.') if total_num_items == float('inf'): # Set proper total_num_items |