From efa550d24cf08a92dce33ed0a09494a7c571c265 Mon Sep 17 00:00:00 2001 From: Jiri Kyjovsky Date: Tue, 2 Aug 2022 13:21:06 +0200 Subject: [PATCH] Feat(jobs): Add retriggered Bodhi handler to jobs matching event This is due to different job_config_trigger_types (pull_request/commit) in retrigerring bodhi via dist-git PR. --- packit_service/worker/jobs.py | 4 ++-- tests/unit/test_jobs.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/packit_service/worker/jobs.py b/packit_service/worker/jobs.py index be4c5571f..8d9768c26 100644 --- a/packit_service/worker/jobs.py +++ b/packit_service/worker/jobs.py @@ -467,7 +467,7 @@ def is_project_public_or_enabled_private(self) -> bool: return True - def check_explicit_matching(self): + def check_explicit_matching(self) -> List[JobConfig]: """Force explicit event/jobs matching for triggers Returns: @@ -477,7 +477,7 @@ def check_explicit_matching(self): if isinstance(self.event, PullRequestCommentPagureEvent): for job in self.event.package_config.jobs: if ( - job.type == JobType.koji_build + job.type in [JobType.koji_build, JobType.bodhi_update] and job.trigger == JobConfigTriggerType.commit and self.event.job_config_trigger_type == JobConfigTriggerType.pull_request diff --git a/tests/unit/test_jobs.py b/tests/unit/test_jobs.py index a2c991b41..c9043332e 100644 --- a/tests/unit/test_jobs.py +++ b/tests/unit/test_jobs.py @@ -2399,6 +2399,22 @@ def __init__(self): ), ], ), + pytest.param( + PullRequestCommentPagureEvent, + JobConfigTriggerType.pull_request, + [ + JobConfig( + type=JobType.bodhi_update, + trigger=JobConfigTriggerType.commit, + ), + ], + [ + JobConfig( + type=JobType.bodhi_update, + trigger=JobConfigTriggerType.commit, + ), + ], + ), ], ) def test_get_jobs_matching_trigger(event_kls, job_config_trigger_type, jobs, result):