From af4651069f32f95ddb8b1f5df965318cd39641fc Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Apr 11 2025 10:42:08 +0000
Subject: determine_rhel_state: Handle z-stream branches


This function is called by the `check-tickets` task in the Gitlab
pipelines, which now also run for Z-stream branches for some RHEL
packages. We need to ensure that they are properly validating the rules
for those Z-stream branches. Prior to this patch, they were being
bundled into the handling for stream branches (which is to say their
rules were being ignored).

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>

---

diff --git a/src/centpkg/utils.py b/src/centpkg/utils.py
index 7ad4543..9a744d5 100644
--- a/src/centpkg/utils.py
+++ b/src/centpkg/utils.py
@@ -516,7 +516,9 @@ def determine_rhel_state(
     # First, check if this package has a RHEL counterpart or is CentOS Stream
     # only.
     try:
-        if repo_name in get_unsynced_projects(distrobaker_config, namespace):
+        if not cs_branch.startswith("rhel-") and repo_name in get_unsynced_projects(
+            distrobaker_config, namespace
+        ):
             # We don't need to do any looking up, because it will always use the
             # stream version and never enforce tickets. It will return
             # rhel_target_default="none" to instruct distrobaker not to attempt
@@ -536,9 +538,10 @@ def determine_rhel_state(
     try:
         x_version, rhel_version = stream_mapping(cs_branch)
     except StreamMappingError as e:
-        # This is not a standard branch name, so it's probably either a custom
-        # branch or a module stream branch. Either way, we'll return it as-is
-        # and always treat it as if it is in enforcing mode.
+        # This is not a standard branch name, so it's probably a RHEL Z-stream
+        # branch, a custom branch or a module stream branch. In any of these
+        # cases, we'll return it as-is and always treat it as if it is in
+        # enforcing mode.
         return rhel_state_nt(
             latest_version=cs_branch,
             target_version=cs_branch,