Skip to content

Commit ecd5758

Browse files
rzrydirson
andcommitted
koji: Handle undeclared branches differently than empty set...
Which is semantically different, as explained in review but from user perspective both will fail (but logs will be more accurate). Also relocate the smaller scope closer to test, for readability. Relate-to: #774 (comment) Co-authored-by: Yann Dirson <yann.dirson@vates.tech> Signed-off-by: Philippe Coval <philippe.coval@vates.tech>
1 parent 6b96faf commit ecd5758

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/koji/koji_build.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ def check_commit_is_available_remotely(dirpath, hash, target, warn):
5454
raise Exception("Building with a user target requires using --pre-build or --test-build.\n")
5555
try:
5656
supported_branches = PROTECTED_TARGETS.get(target)
57-
if supported_branches:
57+
if supported_branches is None:
58+
raise Exception(f"Protected target {target} has no allowed branches.")
59+
else:
5860
for branch in supported_branches:
5961
try:
6062
if is_remote_branch_commit(dirpath, hash, branch):
@@ -65,8 +67,6 @@ def check_commit_is_available_remotely(dirpath, hash, target, warn):
6567
else:
6668
raise Exception(f"The current commit is not the last commit of any remote branches {supported_branches}.\n"
6769
f"This is required when using the protected target {target}.")
68-
else:
69-
raise Exception(f"Protected target {target} has no allowed branches.")
7070
except Exception as e:
7171
if warn:
7272
print(f"warning: {e}", flush=True)

0 commit comments

Comments
 (0)