Skip to content

Making the Jira character limit configurable and reducing for addons team per request #1134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/config.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
parameters:
jira_project_key: WEBEXT
labels_brackets: both
jira_char_limit: 10000

- whiteboard_tag: fidedi
bugzilla_user_id: tbd
Expand Down
15 changes: 6 additions & 9 deletions jbi/jira/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@

logger = logging.getLogger(__name__)


JIRA_DESCRIPTION_CHAR_LIMIT = 32667

JIRA_REQUIRED_PERMISSIONS = {
"ADD_COMMENTS",
"CREATE_ISSUES",
Expand Down Expand Up @@ -79,7 +76,7 @@ def create_jira_issue(
"summary": bug.summary,
"issuetype": {"name": issue_type},
"description": markdown_to_jira(
description, max_length=JIRA_DESCRIPTION_CHAR_LIMIT
description, max_length=context.action.parameters.jira_char_limit
),
"project": {"key": context.jira.project},
}
Expand Down Expand Up @@ -134,7 +131,7 @@ def add_jira_comment(self, context: ActionContext):
prefix = f"*{commenter}* commented: \n"
formatted_comment = prefix + markdown_to_jira(
comment.body,
max_length=JIRA_DESCRIPTION_CHAR_LIMIT - len(prefix),
max_length=context.action.parameters.jira_char_limit - len(prefix),
)

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

if len(truncated_summary) > JIRA_DESCRIPTION_CHAR_LIMIT:
if len(truncated_summary) > context.action.parameters.jira_char_limit:
# Truncate on last word.
truncated_summary = truncated_summary[:JIRA_DESCRIPTION_CHAR_LIMIT].rsplit(
maxsplit=1
)[0]
truncated_summary = truncated_summary[
: context.action.parameters.jira_char_limit
].rsplit(maxsplit=1)[0]

return self.update_issue_field(
context, field="summary", value=truncated_summary
Expand Down
1 change: 1 addition & 0 deletions jbi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class ActionParams(BaseModel, frozen=True):

jira_project_key: str
steps: ActionSteps = ActionSteps()
jira_char_limit: int = 32667
jira_components: JiraComponents = JiraComponents()
jira_cf_fx_points_field: str = "customfield_10037"
jira_severity_field: str = "customfield_10319"
Expand Down
Loading