Skip to content

Commit a3179d0

Browse files
committed
Make cve_id member of BackportData optional
In case TriageAgent is not triaging CVE, it does not make sense to require cve_id. Resolves: packit/jotnar#237
1 parent 863126e commit a3179d0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

agents/backport_agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ async def main() -> None:
220220

221221
class State(PackageUpdateState):
222222
upstream_fix: str
223-
cve_id: str
223+
cve_id: str | None
224224
unpacked_sources: Path | None = Field(default=None)
225225
backport_log: list[str] = Field(default=[])
226226
backport_result: BackportOutputSchema | None = Field(default=None)
@@ -473,7 +473,7 @@ async def comment_in_jira(state):
473473
dist_git_branch=branch,
474474
upstream_fix=upstream_fix,
475475
jira_issue=jira_issue,
476-
cve_id=os.getenv("CVE_ID", ""),
476+
cve_id=os.getenv("CVE_ID", None),
477477
redis_conn=None,
478478
)
479479
logger.info(f"Direct run completed: {state.backport_result.model_dump_json(indent=4)}")

common/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class BackportInputSchema(BaseModel):
9494
package: str = Field(description="Package to update")
9595
dist_git_branch: str = Field(description="Git branch in dist-git to be updated")
9696
jira_issue: str = Field(description="Jira issue to reference as resolved")
97-
cve_id: str = Field(default="", description="CVE ID if the jira issue is a CVE")
97+
cve_id: str | None = Field(default=None, description="CVE ID if the jira issue is a CVE")
9898
build_error: str | None = Field(description="Error encountered during package build")
9999

100100

@@ -133,7 +133,7 @@ class BackportData(BaseModel):
133133
patch_url: str = Field(description="URL to the source of the fix that was validated using PatchValidator tool")
134134
justification: str = Field(description="Clear explanation of why this patch fixes the issue, linking it to the root cause")
135135
jira_issue: str = Field(description="Jira issue identifier")
136-
cve_id: str = Field(description="CVE identifier")
136+
cve_id: str | None = Field(description="CVE identifier", default=None)
137137
fix_version: str | None = Field(description="Fix version in Jira (e.g., 'rhel-9.8')", default=None)
138138

139139

0 commit comments

Comments
 (0)