File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
packit_service/worker/helpers/build Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 11# Copyright Contributors to the Packit project.
22# SPDX-License-Identifier: MIT
33
4+ import fnmatch
45import logging
56import re
67from collections .abc import Iterable
@@ -392,7 +393,10 @@ def is_forge_project_allowed_to_build_in_copr(self) -> bool:
392393 self .job_project ,
393394 )
394395 allowed_projects = copr_project ["packit_forge_projects_allowed" ]
395- allowed = self .forge_project in allowed_projects
396+ allowed = any (
397+ fnmatch .fnmatch (self .forge_project , pattern )
398+ for pattern in allowed_projects .splitlines ()
399+ )
396400 if not allowed :
397401 logger .warning (
398402 f"git-forge project { self .forge_project } "
Original file line number Diff line number Diff line change @@ -2713,6 +2713,21 @@ def test_copr_project_and_namespace(
27132713 True ,
27142714 id = "present" ,
27152715 ),
2716+ pytest .param (
2717+ JobConfig (
2718+ type = JobType .copr_build ,
2719+ trigger = JobConfigTriggerType .pull_request ,
2720+ packages = {
2721+ "package" : CommonPackageConfig (
2722+ owner = "the-owner" ,
2723+ project = "the-project" ,
2724+ ),
2725+ },
2726+ ),
2727+ "git.instance.io/the/example/namespace/*" ,
2728+ True ,
2729+ id = "wildcard" ,
2730+ ),
27162731 pytest .param (
27172732 JobConfig (
27182733 type = JobType .copr_build ,
@@ -2728,6 +2743,21 @@ def test_copr_project_and_namespace(
27282743 True ,
27292744 id = "present-more-values" ,
27302745 ),
2746+ pytest .param (
2747+ JobConfig (
2748+ type = JobType .copr_build ,
2749+ trigger = JobConfigTriggerType .pull_request ,
2750+ packages = {
2751+ "package" : CommonPackageConfig (
2752+ owner = "the-owner" ,
2753+ project = "the-project" ,
2754+ ),
2755+ },
2756+ ),
2757+ "something/different\n git.instance.io/the/example/namespace/*" ,
2758+ True ,
2759+ id = "wildcard-more-values" ,
2760+ ),
27312761 ],
27322762)
27332763def test_check_if_custom_copr_can_be_used_and_report (
You can’t perform that action at this time.
0 commit comments