From bf53d314fa4ee23ae6d0b0c5986c650c421b19bb Mon Sep 17 00:00:00 2001 From: Ali Hijazi Date: Mon, 27 May 2024 15:27:56 +0000 Subject: [PATCH] Set component id if a numeric component is available in the component list --- .../google_issue_tracker/issue_tracker.py | 10 ++++++++-- .../google_issue_tracker/google_issue_tracker_test.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/clusterfuzz/_internal/issue_management/google_issue_tracker/issue_tracker.py b/src/clusterfuzz/_internal/issue_management/google_issue_tracker/issue_tracker.py index fd83fc287a..186c4976b3 100644 --- a/src/clusterfuzz/_internal/issue_management/google_issue_tracker/issue_tracker.py +++ b/src/clusterfuzz/_internal/issue_management/google_issue_tracker/issue_tracker.py @@ -686,8 +686,14 @@ def save(self, new_comment=None, notify=True): # Make sure self.labels contains only hotlist IDs. self._filter_labels() - if self.component_id: - self._data['issueState']['componentId'] = int(self.component_id) + # Best effort setting on componentId from list of components. + # Set the componentId to the first encountered numeric component + # in the component list. + for component in list(self.components): + if component.isnumeric(): + self._data['issueState']['componentId'] = int(component) + break + ccs = list(self._ccs) if ccs: self._data['issueState']['ccs'] = _make_users(ccs) diff --git a/src/clusterfuzz/_internal/tests/appengine/libs/issue_management/google_issue_tracker/google_issue_tracker_test.py b/src/clusterfuzz/_internal/tests/appengine/libs/issue_management/google_issue_tracker/google_issue_tracker_test.py index 462ab085d8..0b27c84987 100644 --- a/src/clusterfuzz/_internal/tests/appengine/libs/issue_management/google_issue_tracker/google_issue_tracker_test.py +++ b/src/clusterfuzz/_internal/tests/appengine/libs/issue_management/google_issue_tracker/google_issue_tracker_test.py @@ -366,7 +366,7 @@ def test_new_issue_with_component_tags(self): body={ 'issueState': { 'componentId': - 1337, + 1456567, 'ccs': [{ 'emailAddress': 'cc@google.com' }],