Skip to content

Commit b64fb4d

Browse files
authored
Add repo URL to bisection message for OSV. (#2618)
1 parent 999e67f commit b64fb4d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/clusterfuzz/_internal/base/bisection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def _make_bisection_request(pubsub_topic, testcase, target, bisect_type):
131131
old_commit, new_commit = _check_commits(testcase, bisect_type, old_commit,
132132
new_commit)
133133

134+
repo_url = data_handler.get_main_repo(testcase.job_type) or ''
134135
reproducer = blobs.read_key(testcase.minimized_keys or testcase.fuzzed_keys)
135136
pubsub_client = pubsub.PubSubClient()
136137
pubsub_client.publish(pubsub_topic, [
@@ -165,6 +166,8 @@ def _make_bisection_request(pubsub_topic, testcase, target, bisect_type):
165166
testcase.security_severity),
166167
'timestamp':
167168
testcase.timestamp.isoformat(),
169+
'repo_url':
170+
repo_url,
168171
})
169172
])
170173
return True

src/clusterfuzz/_internal/tests/core/base/bisection_test.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,18 @@ def setUp(self):
7070
additional_metadata='{"last_tested_crash_revision": 4}')
7171
self.testcase.put()
7272

73+
data_types.Job(
74+
name='libfuzzer_asan_proj',
75+
environment_string='MAIN_REPO = https://repo_url').put()
76+
7377
self.mock.read_key.return_value = b'reproducer'
7478
self.mock.get_component_range_list.return_value = [
7579
{
7680
'link_text': 'old:new',
7781
},
7882
]
7983

80-
def _test(self, sanitizer, old_commit='old', new_commit='new'):
84+
def _test(self, sanitizer, old_commit='old', new_commit='new', repo_url=''):
8185
"""Test task publication."""
8286
bisection.request_bisection(self.testcase)
8387
publish_calls = self.mock.publish.call_args_list
@@ -98,6 +102,7 @@ def _test(self, sanitizer, old_commit='old', new_commit='new'):
98102
'new_commit': new_commit,
99103
'old_commit': old_commit,
100104
'project_name': 'proj',
105+
'repo_url': repo_url,
101106
'sanitizer': sanitizer,
102107
'testcase_id': '1',
103108
'issue_id': '1337',
@@ -113,7 +118,7 @@ def test_request_bisection_asan(self):
113118
"""Basic regressed test (asan)."""
114119
self.testcase.job_type = 'libfuzzer_asan_proj'
115120
self.testcase.put()
116-
self._test('address')
121+
self._test('address', repo_url='https://repo_url')
117122

118123
def test_request_bisection_msan(self):
119124
"""Basic regressed test (asan)."""
@@ -199,7 +204,11 @@ def test_request_single_commit_range(self):
199204
},
200205
]
201206
bisection.request_bisection(self.testcase)
202-
self._test('address', old_commit='one', new_commit='one')
207+
self._test(
208+
'address',
209+
old_commit='one',
210+
new_commit='one',
211+
repo_url='https://repo_url')
203212
self.mock.get_component_range_list.assert_has_calls([
204213
mock.call(123, 456, 'libfuzzer_asan_proj'),
205214
mock.call(0, 3, 'libfuzzer_asan_proj'),

0 commit comments

Comments
 (0)