Skip to content

Commit 621552e

Browse files
authored
Making the Jira character limit configurable and reducing for addons team per request (#1134)
* Reducing jira char limit by 100 so Jira doesn't overrun this when completing markdown tags * Making character limit configurable and overriding for the addons team as requested
1 parent 7ba3ce0 commit 621552e

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

config/config.prod.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
parameters:
77
jira_project_key: WEBEXT
88
labels_brackets: both
9+
jira_char_limit: 10000
910

1011
- whiteboard_tag: fidedi
1112
bugzilla_user_id: tbd

jbi/jira/service.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525

2626
logger = logging.getLogger(__name__)
2727

28-
29-
JIRA_DESCRIPTION_CHAR_LIMIT = 32667
30-
3128
JIRA_REQUIRED_PERMISSIONS = {
3229
"ADD_COMMENTS",
3330
"CREATE_ISSUES",
@@ -79,7 +76,7 @@ def create_jira_issue(
7976
"summary": bug.summary,
8077
"issuetype": {"name": issue_type},
8178
"description": markdown_to_jira(
82-
description, max_length=JIRA_DESCRIPTION_CHAR_LIMIT
79+
description, max_length=context.action.parameters.jira_char_limit
8380
),
8481
"project": {"key": context.jira.project},
8582
}
@@ -134,7 +131,7 @@ def add_jira_comment(self, context: ActionContext):
134131
prefix = f"*{commenter}* commented: \n"
135132
formatted_comment = prefix + markdown_to_jira(
136133
comment.body,
137-
max_length=JIRA_DESCRIPTION_CHAR_LIMIT - len(prefix),
134+
max_length=context.action.parameters.jira_char_limit - len(prefix),
138135
)
139136

140137
issue_key = context.jira.issue
@@ -317,11 +314,11 @@ def update_issue_summary(self, context: ActionContext):
317314
"""Update's an issue's summary with the description of an incoming bug"""
318315
truncated_summary = context.bug.summary or ""
319316

320-
if len(truncated_summary) > JIRA_DESCRIPTION_CHAR_LIMIT:
317+
if len(truncated_summary) > context.action.parameters.jira_char_limit:
321318
# Truncate on last word.
322-
truncated_summary = truncated_summary[:JIRA_DESCRIPTION_CHAR_LIMIT].rsplit(
323-
maxsplit=1
324-
)[0]
319+
truncated_summary = truncated_summary[
320+
: context.action.parameters.jira_char_limit
321+
].rsplit(maxsplit=1)[0]
325322

326323
return self.update_issue_field(
327324
context, field="summary", value=truncated_summary

jbi/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class ActionParams(BaseModel, frozen=True):
8787

8888
jira_project_key: str
8989
steps: ActionSteps = ActionSteps()
90+
jira_char_limit: int = 32667
9091
jira_components: JiraComponents = JiraComponents()
9192
jira_cf_fx_points_field: str = "customfield_10037"
9293
jira_severity_field: str = "customfield_10319"

0 commit comments

Comments
 (0)