Skip to content

Commit

Permalink
Feat(jobs): Add retriggered Bodhi handler to jobs matching event
Browse files Browse the repository at this point in the history
This is due to different job_config_trigger_types (pull_request/commit)
in retrigerring bodhi via dist-git PR.
  • Loading branch information
nikromen committed Sep 14, 2022
1 parent 8089789 commit efa550d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packit_service/worker/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit efa550d

Please sign in to comment.