mozilla / jira-bugzilla-integration

Jira Bugzilla Integration (JBI) - system to sync bugs and issues
Mozilla Public License 2.0
8 stars 22 forks source link

Use specific 'severity' field on FIDEFE #901

Closed leplatrem closed 4 months ago

leplatrem commented 4 months ago

There are several severity fields on Jira:

>>> [f for f in s.client.get_all_fields() if 'severity' in f["name"].lower()]
[{'id': 'customfield_10716', 'key': 'customfield_10716', 'name': 'Severity', 'untranslatedName': 'Severity', 'custom': True, 'orderable': True, 'navigable': True, 'searchable': True, 'clauseNames': ['cf[10716]', 'Severity', 'Severity[Dropdown]'], 'schema': {'type': 'option', 'custom': 'com.atlassian.jira.plugin.system.customfieldtypes:select', 'customId': 10716}}, 

{'id': 'customfield_10319', 'key': 'customfield_10319', 'name': 'Severity ', 'untranslatedName': 'Severity ', 'custom': True, 'orderable': True, 'navigable': True, 'searchable': True, 'clauseNames': ['cf[10319]', 'Severity ', 'Severity [Dropdown]'], 'schema': {'type': 'option', 'custom': 'com.atlassian.jira.plugin.system.customfieldtypes:select', 'customId': 10319}},

 {'id': 'customfield_10769', 'key': 'customfield_10769', 'name': 'Severity Level', 'untranslatedName': 'Severity Level', 'custom': True, 'orderable': True, 'navigable': True, 'searchable': True, 'clauseNames': ['cf[10769]', 'Severity Level', 'Severity Level[Dropdown]'], 'schema': {'type': 'option', 'custom': 'com.atlassian.jira.plugin.system.customfieldtypes:select', 'customId': 10769}}]

FIDEFE does not use the one by default:

>>> s.client.update_issue_field(key="FIDEFE-4773", fields={"customfield_10716": {"value": "S4"}})
Traceback (most recent call last):
  File "/Users/mathieu/Code/Mozilla/jira-bugzilla-integration/jbi/jira/client.py", line 53, in raise_for_status
    return super().raise_for_status(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mathieu/Code/Mozilla/jira-bugzilla-integration/.venv/lib/python3.12/site-packages/atlassian/rest_client.py", line 549, in raise_for_status
    raise HTTPError(error_msg, response=response)
requests.exceptions.HTTPError

This PR changes it to the specific one that's used there:

>>> s.client.update_issue_field(key="FIDEFE-4773", fields={"customfield_10319": {"value": "S4"}})
>>>