6666 MAP_COMMENT_TO_HANDLER_FEDORA_CI ,
6767 MAP_JOB_TYPE_TO_HANDLER ,
6868 MAP_REQUIRED_JOB_TYPE_TO_HANDLER ,
69+ MAP_TARGET_TO_HANDLER ,
6970 SUPPORTED_EVENTS_FOR_HANDLER ,
7071 SUPPORTED_EVENTS_FOR_HANDLER_FEDORA_CI ,
7172 FedoraCIJobHandler ,
112113class ParsedComment :
113114 command : Optional [str ] = None
114115 package : Optional [str ] = None
116+ check_target : Optional [str ] = None
115117
116118
117119def parse_comment (
@@ -143,7 +145,8 @@ def parse_comment(
143145
144146 try :
145147 args = parser .parse_args (commands )
146- return ParsedComment (command = args .command , package = args .package )
148+ check_target = getattr (args , "check_target" , None )
149+ return ParsedComment (command = args .command , package = args .package , check_target = check_target )
147150 except SystemExit :
148151 # tests expect invalid syntax comments be ignored
149152 logger .debug (
@@ -176,12 +179,16 @@ def get_handlers_for_command(
176179
177180def get_handlers_for_command_fedora_ci (
178181 command : str ,
182+ check_target : Optional [str ],
179183) -> set [type [FedoraCIJobHandler ]]:
180184 """
181- Get handlers for the given command.
185+ Get handlers for the given command. If check_target is specified
186+ (for example: eln), then only handlers relevant to this target
187+ will be returned.
182188
183189 Args:
184190 command: command to get handler to
191+ check_target: target for which to run jobs
185192
186193 Returns:
187194 Set of handlers for Fecora CI that are triggered by command.
@@ -192,6 +199,12 @@ def get_handlers_for_command_fedora_ci(
192199 handlers = MAP_COMMENT_TO_HANDLER_FEDORA_CI [command ]
193200 if not handlers :
194201 logger .debug (f"Command { command } not supported by packit." )
202+
203+ if check_target :
204+ handlers = {
205+ handler for handler in handlers if MAP_TARGET_TO_HANDLER [handler ] == check_target
206+ }
207+
195208 return handlers
196209
197210
@@ -552,7 +565,11 @@ def _post_fedora_ci_transition_comment(self) -> None:
552565 # Don't fail the job if we can't post the comment
553566 logger .warning (f"Failed to post CI transition comment: { ex } " )
554567
555- def report_task_accepted_for_fedora_ci (self , handler_kls : type [FedoraCIJobHandler ]):
568+ def report_task_accepted_for_fedora_ci (
569+ self ,
570+ handler_kls : type [FedoraCIJobHandler ],
571+ user_specified_target_branch : Optional [str ] = None ,
572+ ):
556573 """
557574 For CI-related dist-git PR comment events report the initial status
558575 "Task was accepted" to inform user we are working on the request.
@@ -572,10 +589,12 @@ def report_task_accepted_for_fedora_ci(self, handler_kls: type[FedoraCIJobHandle
572589 if (target_branch := self .event .pull_request_object .target_branch ) == "main" :
573590 target_branch = "rawhide"
574591
592+ # target_branch determines the check's title such as:
593+ # "Packit - installability - rawhide [beaf90b]"
575594 helper = FedoraCIHelper (
576595 project = self .event .project ,
577596 metadata = metadata ,
578- target_branch = target_branch ,
597+ target_branch = user_specified_target_branch or target_branch ,
579598 )
580599
581600 first_status_reported = False
@@ -683,9 +702,10 @@ def process_fedora_ci_jobs(self) -> list[TaskResults]:
683702 A list of task results for each task created.
684703 """
685704 handlers_triggered_by_job = None
705+ check_target = None
706+
686707 # [XXX] if there are ever monorepos in Fedora CI…
687708 # monorepo_package = None
688-
689709 if isinstance (self .event , abstract .comment .CommentEvent ):
690710 arguments = parse_comment (
691711 self .event .comment ,
@@ -695,7 +715,8 @@ def process_fedora_ci_jobs(self) -> list[TaskResults]:
695715 # [XXX] if there are ever monorepos in Fedora CI…
696716 # monorepo_package = arguments.package
697717 command = arguments .command
698- handlers_triggered_by_job = get_handlers_for_command_fedora_ci (command )
718+ check_target = getattr (arguments , "check_target" , None )
719+ handlers_triggered_by_job = get_handlers_for_command_fedora_ci (command , check_target )
699720
700721 matching_handlers = {
701722 handler
@@ -726,7 +747,7 @@ def process_fedora_ci_jobs(self) -> list[TaskResults]:
726747 # if monorepo_package and handler_kls.job_config.package == monorepo_package:
727748 # continue
728749
729- self .report_task_accepted_for_fedora_ci (handler_kls )
750+ self .report_task_accepted_for_fedora_ci (handler_kls , check_target )
730751
731752 celery_signature = celery .signature (
732753 handler_kls .task_name .value ,
0 commit comments