]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fail for branches using old-style version suffixes
authorMichał Kępień <michal@isc.org>
Mon, 3 Jun 2024 11:07:21 +0000 (13:07 +0200)
committerMichał Kępień <michal@isc.org>
Mon, 3 Jun 2024 11:11:42 +0000 (11:11 +0000)
Using "-v9_x" and "-v9.x" version suffixes for branch names is now
deprecated since some automation logic does not handle these.  Fail for
any merge request using such old-style version suffixes.

(cherry picked from commit 09851e62309f55bb3e6e3bc7299db95929827f76)

dangerfile.py

index 5dd2f18c51e452de75283efb457a25f798eca3f9..81eca5f58305196c8851905af7a989c36fc66c58 100644 (file)
@@ -49,6 +49,7 @@ affected_files = (
     danger.git.modified_files + danger.git.created_files + danger.git.deleted_files
 )
 mr_labels = danger.gitlab.mr.labels
+source_branch = danger.gitlab.mr.source_branch
 target_branch = danger.gitlab.mr.target_branch
 is_backport = "Backport" in mr_labels or "Backport::Partial" in mr_labels
 is_full_backport = is_backport and "Backport::Partial" not in mr_labels
@@ -60,6 +61,23 @@ gl = gitlab.Gitlab(
 proj = gl.projects.get(os.environ["CI_PROJECT_ID"])
 mr = proj.mergerequests.get(os.environ["CI_MERGE_REQUEST_IID"])
 
+###############################################################################
+# BRANCH NAME
+###############################################################################
+#
+# - FAIL if the source branch of the merge request includes an old-style
+#   "-v9_x" or "-v9.x" suffix.
+
+branch_name_regex = r"^(?P<base>.*?)(?P<suffix>-v9[_.](?P<version>[0-9]+))$"
+match = re.match(branch_name_regex, source_branch)
+if match:
+    fail(
+        f"Source branch name `{source_branch}` includes an old-style version "
+        f"suffix (`{match.group('suffix')}`). Using such suffixes is now "
+        "deprecated. Please resubmit the merge request with the branch name "
+        f"set to `{match.group('base')}-bind-9.{match.group('version')}`."
+    )
+
 ###############################################################################
 # COMMIT MESSAGES
 ###############################################################################