2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Handle empty MR description in dangerfile

A merge request might have no description at all (i.e. None, rather than
an empty string). This might happen when the MR is created via an API.
Check a description is present before trying to find a backport string
in it.
This commit is contained in:
Tom Krizek
2023-12-08 16:31:46 +01:00
committed by Michal Nowak
parent 43126e81e6
commit 4f70f5bd7c

View File

@@ -186,7 +186,6 @@ BACKPORT_OF_RE = re.compile(
r"Backport\s+of.*(merge_requests/|!)([0-9]+)", flags=re.IGNORECASE
)
VERSION_LABEL_RE = re.compile(r"v9.([0-9]+)(-S)?")
backport_desc = BACKPORT_OF_RE.search(danger.gitlab.mr.description)
version_labels = [l for l in mr_labels if l.startswith("v9.")]
affects_labels = [l for l in mr_labels if l.startswith("Affects v9.")]
if is_backport:
@@ -205,6 +204,7 @@ if is_backport:
"Backport MRs must have their target version in the title. "
f"Please put `[9.{minor_ver}{edition}]` at the start of the MR title."
)
backport_desc = BACKPORT_OF_RE.search(danger.gitlab.mr.description or "")
if backport_desc is None:
fail(
"Backport MRs must link to the original MR. Please put "