diff options
author | jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> | 2021-07-21 11:36:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-21 11:36:11 -0700 |
commit | 2a3a1e903ad196b95cca997a8379ccd4678402dc (patch) | |
tree | cf5ac0a70c11bdded02421407e84602e8f395016 | |
parent | 6baa5e3e68be407b1c9698d36d7d3be82aedc3d5 (diff) | |
download | oss-fuzz-2a3a1e903ad196b95cca997a8379ccd4678402dc.tar.gz |
[CIFuzz] Add cifuzz- prefix to all artifacts (#6084)
This will prevent conflicts with other artifacts in the repo.
4 files changed, 15 insertions, 4 deletions
diff --git a/infra/cifuzz/clusterfuzz_deployment.py b/infra/cifuzz/clusterfuzz_deployment.py index a21883061..fe5d88145 100644 --- a/infra/cifuzz/clusterfuzz_deployment.py +++ b/infra/cifuzz/clusterfuzz_deployment.py @@ -89,7 +89,7 @@ class BaseClusterFuzzDeployment: class ClusterFuzzLite(BaseClusterFuzzDeployment): """Class representing a deployment of ClusterFuzzLite.""" - BASE_BUILD_NAME = 'cifuzz-build-' + BASE_BUILD_NAME = 'build-' COVERAGE_NAME = 'coverage' def __init__(self, config, workspace): diff --git a/infra/cifuzz/clusterfuzz_deployment_test.py b/infra/cifuzz/clusterfuzz_deployment_test.py index 900d57ceb..1c58a3f31 100644 --- a/infra/cifuzz/clusterfuzz_deployment_test.py +++ b/infra/cifuzz/clusterfuzz_deployment_test.py @@ -164,7 +164,7 @@ class ClusterFuzzLiteTest(fake_filesystem_unittest.TestCase): circumstances.""" self.assertEqual(self.deployment.download_latest_build(), EXPECTED_LATEST_BUILD_PATH) - expected_artifact_name = 'cifuzz-build-address' + expected_artifact_name = 'build-address' mocked_download_latest_build.assert_called_with(expected_artifact_name, EXPECTED_LATEST_BUILD_PATH) diff --git a/infra/cifuzz/filestore/github_actions/__init__.py b/infra/cifuzz/filestore/github_actions/__init__.py index 47f63f286..69fc4cc05 100644 --- a/infra/cifuzz/filestore/github_actions/__init__.py +++ b/infra/cifuzz/filestore/github_actions/__init__.py @@ -46,12 +46,20 @@ class GithubActionsFilestore(filestore.BaseFilestore): downloading artifacts from other runs. The standard GitHub API does support this however.""" + ARTIFACT_PREFIX = 'cifuzz-' + def __init__(self, config): super().__init__(config) self.github_api_http_headers = github_api.get_http_auth_headers(config) + def _get_artifact_name(self, name): + if name.startswith(self.ARTIFACT_PREFIX): + return name + return f'{self.ARTIFACT_PREFIX}{name}' + def upload_directory(self, name, directory): # pylint: disable=no-self-use """Uploads |directory| as artifact with |name|.""" + name = self.get_artifact_name(name) with tempfile.TemporaryDirectory() as temp_dir: archive_path = os.path.join(temp_dir, name + '.tar') tar_directory(directory, archive_path) @@ -73,6 +81,7 @@ class GithubActionsFilestore(filestore.BaseFilestore): def _download_artifact(self, name, dst_directory): """Downloads artifact with |name| to |dst_directory|.""" + name = self._get_artifact_name(name) artifact = self._find_artifact(name) if not artifact: logging.warning('Could not download artifact: %s.', name) diff --git a/infra/cifuzz/filestore/github_actions/github_actions_test.py b/infra/cifuzz/filestore/github_actions/github_actions_test.py index eb1fed056..1144f0dc1 100644 --- a/infra/cifuzz/filestore/github_actions/github_actions_test.py +++ b/infra/cifuzz/filestore/github_actions/github_actions_test.py @@ -70,7 +70,8 @@ class GithubActionsFilestoreTest(unittest.TestCase): name = 'build-name' build_dir = 'build-dir' self.assertIsNone(filestore.download_latest_build(name, build_dir)) - mocked_warning.assert_called_with('Could not download artifact: %s.', name) + mocked_warning.assert_called_with('Could not download artifact: %s.', + 'cifuzz-' + name) @mock.patch('logging.warning') @mock.patch('filestore.github_actions.GithubActionsFilestore._list_artifacts', @@ -85,7 +86,8 @@ class GithubActionsFilestoreTest(unittest.TestCase): name = 'corpus-name' dst_dir = 'corpus-dir' self.assertFalse(filestore.download_corpus(name, dst_dir)) - mocked_warning.assert_called_with('Could not download artifact: %s.', name) + mocked_warning.assert_called_with('Could not download artifact: %s.', + 'cifuzz-' + name) class TarDirectoryTest(unittest.TestCase): |