fix(jira): correct ticket hierarchy — campaigns=Epic, all tests=Task
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
- Campaign issue type changed from Task to Epic (required to nest under Initiative OFS-20795 in classic Jira) - Added customfield_10011 (Epic Name) — required when creating Epics - Removed JIRA_ISSUE_TYPE_SUBTASK; all tests are now Task regardless of whether they are inside a campaign or standalone - Standalone tests use the configured standalone parent (OFS-20798, an Epic) so Task→Task parent is never attempted - Campaign tests use the campaign Epic key passed via parent_ticket_override Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -51,9 +51,8 @@ class Settings(BaseSettings):
|
|||||||
JIRA_API_TOKEN: str = ""
|
JIRA_API_TOKEN: str = ""
|
||||||
JIRA_IS_CLOUD: bool = True
|
JIRA_IS_CLOUD: bool = True
|
||||||
JIRA_DEFAULT_PROJECT: str = ""
|
JIRA_DEFAULT_PROJECT: str = ""
|
||||||
JIRA_ISSUE_TYPE_TEST: str = "Task"
|
JIRA_ISSUE_TYPE_TEST: str = "Task" # tests (campaign or standalone)
|
||||||
JIRA_ISSUE_TYPE_CAMPAIGN: str = "Task"
|
JIRA_ISSUE_TYPE_CAMPAIGN: str = "Epic" # campaigns (under Initiative)
|
||||||
JIRA_ISSUE_TYPE_SUBTASK: str = "Sub-task"
|
|
||||||
|
|
||||||
# ── Tempo Integration ─────────────────────────────────────────────
|
# ── Tempo Integration ─────────────────────────────────────────────
|
||||||
TEMPO_ENABLED: bool = False
|
TEMPO_ENABLED: bool = False
|
||||||
|
|||||||
@@ -406,9 +406,11 @@ def auto_create_campaign_issue(
|
|||||||
"description": _build_campaign_description(campaign),
|
"description": _build_campaign_description(campaign),
|
||||||
"issuetype": {"name": settings.JIRA_ISSUE_TYPE_CAMPAIGN},
|
"issuetype": {"name": settings.JIRA_ISSUE_TYPE_CAMPAIGN},
|
||||||
"labels": ["aegis", "campaign"],
|
"labels": ["aegis", "campaign"],
|
||||||
|
# customfield_10011 = Epic Name (required for Epic type in classic Jira)
|
||||||
|
"customfield_10011": campaign.name,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Always nest under the configured parent ticket (e.g. OFS-9107)
|
# Nest under the configured parent ticket (Initiative, e.g. OFS-20795)
|
||||||
if parent_ticket:
|
if parent_ticket:
|
||||||
fields["parent"] = {"key": parent_ticket}
|
fields["parent"] = {"key": parent_ticket}
|
||||||
|
|
||||||
@@ -478,24 +480,13 @@ def auto_create_test_issue(
|
|||||||
try:
|
try:
|
||||||
jira = get_user_jira_client(actor, db)
|
jira = get_user_jira_client(actor, db)
|
||||||
|
|
||||||
# Resolve parent and issue type together:
|
# All tests — whether inside a campaign or standalone — are created
|
||||||
# - campaign parent override → Sub-task (Task cannot parent Task)
|
# as Task. Campaign tests use the campaign Jira key as parent
|
||||||
# - explicit standalone parent configured → Sub-task (same reason;
|
# (passed via parent_ticket_override); standalone tests use the
|
||||||
# the standalone parent is a Task, e.g. OFS-20798)
|
# configured standalone parent ticket (e.g. OFS-20798, which is an
|
||||||
# - only the general parent ticket (Epic) → Task
|
# Epic so it can parent Tasks).
|
||||||
standalone_parent = get_jira_parent_ticket_standalone(db)
|
parent = parent_ticket_override or get_jira_parent_ticket_standalone(db)
|
||||||
general_parent = get_jira_parent_ticket(db)
|
issue_type = settings.JIRA_ISSUE_TYPE_TEST # always Task
|
||||||
parent = parent_ticket_override or standalone_parent
|
|
||||||
|
|
||||||
has_explicit_parent = bool(
|
|
||||||
parent_ticket_override
|
|
||||||
or (standalone_parent and standalone_parent != general_parent)
|
|
||||||
)
|
|
||||||
issue_type = (
|
|
||||||
settings.JIRA_ISSUE_TYPE_SUBTASK
|
|
||||||
if has_explicit_parent
|
|
||||||
else settings.JIRA_ISSUE_TYPE_TEST
|
|
||||||
)
|
|
||||||
|
|
||||||
fields: dict = {
|
fields: dict = {
|
||||||
"project": {"key": project_key},
|
"project": {"key": project_key},
|
||||||
|
|||||||
Reference in New Issue
Block a user