-
Notifications
You must be signed in to change notification settings - Fork 57
Allow retriggering builds/tests on ELN rawhide PRs independently #3032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
cbc633e
a2a8ad4
b34af44
5485763
9f3206c
9b07c8a
70fd423
2ef68b4
82ca6e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,7 @@ | |
| MAP_COMMENT_TO_HANDLER_FEDORA_CI, | ||
| MAP_JOB_TYPE_TO_HANDLER, | ||
| MAP_REQUIRED_JOB_TYPE_TO_HANDLER, | ||
| MAP_TARGET_TO_HANDLER, | ||
| SUPPORTED_EVENTS_FOR_HANDLER, | ||
| SUPPORTED_EVENTS_FOR_HANDLER_FEDORA_CI, | ||
| FedoraCIJobHandler, | ||
|
|
@@ -112,6 +113,7 @@ | |
| class ParsedComment: | ||
| command: Optional[str] = None | ||
| package: Optional[str] = None | ||
| check_target: Optional[str] = None | ||
|
|
||
|
|
||
| def parse_comment( | ||
|
|
@@ -143,7 +145,8 @@ def parse_comment( | |
|
|
||
| try: | ||
| args = parser.parse_args(commands) | ||
| return ParsedComment(command=args.command, package=args.package) | ||
| check_target = getattr(args, "check_target", None) | ||
| return ParsedComment(command=args.command, package=args.package, check_target=check_target) | ||
| except SystemExit: | ||
| # tests expect invalid syntax comments be ignored | ||
| logger.debug( | ||
|
|
@@ -176,12 +179,16 @@ def get_handlers_for_command( | |
|
|
||
| def get_handlers_for_command_fedora_ci( | ||
| command: str, | ||
| check_target: Optional[str], | ||
| ) -> set[type[FedoraCIJobHandler]]: | ||
| """ | ||
| Get handlers for the given command. | ||
| Get handlers for the given command. If check_target is specified | ||
| (for example: eln), then only handlers relevant to this target | ||
| will be returned. | ||
|
|
||
| Args: | ||
| command: command to get handler to | ||
| check_target: target for which to run jobs | ||
|
|
||
| Returns: | ||
| Set of handlers for Fecora CI that are triggered by command. | ||
|
|
@@ -192,6 +199,12 @@ def get_handlers_for_command_fedora_ci( | |
| handlers = MAP_COMMENT_TO_HANDLER_FEDORA_CI[command] | ||
| if not handlers: | ||
| logger.debug(f"Command {command} not supported by packit.") | ||
|
|
||
| if check_target: | ||
| handlers = { | ||
| handler for handler in handlers if MAP_TARGET_TO_HANDLER[handler] == check_target | ||
| } | ||
|
|
||
| return handlers | ||
|
|
||
|
|
||
|
|
@@ -550,7 +563,11 @@ def _post_fedora_ci_transition_comment(self) -> None: | |
| # Don't fail the job if we can't post the comment | ||
| logger.warning(f"Failed to post CI transition comment: {ex}") | ||
|
|
||
| def report_task_accepted_for_fedora_ci(self, handler_kls: type[FedoraCIJobHandler]): | ||
| def report_task_accepted_for_fedora_ci( | ||
| self, | ||
| handler_kls: type[FedoraCIJobHandler], | ||
| user_specified_target_branch: Optional[str] = None, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is a bit tricky, |
||
| ): | ||
| """ | ||
| For CI-related dist-git PR comment events report the initial status | ||
| "Task was accepted" to inform user we are working on the request. | ||
|
|
@@ -570,10 +587,12 @@ def report_task_accepted_for_fedora_ci(self, handler_kls: type[FedoraCIJobHandle | |
| if (target_branch := self.event.pull_request_object.target_branch) == "main": | ||
| target_branch = "rawhide" | ||
|
|
||
| # target_branch determines the check's title such as: | ||
| # "Packit - installability - rawhide [beaf90b]" | ||
| helper = FedoraCIHelper( | ||
| project=self.event.project, | ||
| metadata=metadata, | ||
| target_branch=target_branch, | ||
| target_branch=user_specified_target_branch or target_branch, | ||
| ) | ||
|
|
||
| first_status_reported = False | ||
|
|
@@ -681,9 +700,10 @@ def process_fedora_ci_jobs(self) -> list[TaskResults]: | |
| A list of task results for each task created. | ||
| """ | ||
| handlers_triggered_by_job = None | ||
| check_target = None | ||
|
|
||
| # [XXX] if there are ever monorepos in Fedora CI… | ||
| # monorepo_package = None | ||
|
|
||
| if isinstance(self.event, abstract.comment.CommentEvent): | ||
| arguments = parse_comment( | ||
| self.event.comment, | ||
|
|
@@ -693,7 +713,8 @@ def process_fedora_ci_jobs(self) -> list[TaskResults]: | |
| # [XXX] if there are ever monorepos in Fedora CI… | ||
| # monorepo_package = arguments.package | ||
| command = arguments.command | ||
| handlers_triggered_by_job = get_handlers_for_command_fedora_ci(command) | ||
| check_target = getattr(arguments, "check_target", None) | ||
| handlers_triggered_by_job = get_handlers_for_command_fedora_ci(command, check_target) | ||
|
|
||
| matching_handlers = { | ||
| handler | ||
|
|
@@ -724,7 +745,7 @@ def process_fedora_ci_jobs(self) -> list[TaskResults]: | |
| # if monorepo_package and handler_kls.job_config.package == monorepo_package: | ||
| # continue | ||
|
|
||
| self.report_task_accepted_for_fedora_ci(handler_kls) | ||
| self.report_task_accepted_for_fedora_ci(handler_kls, check_target) | ||
|
|
||
| celery_signature = celery.signature( | ||
| handler_kls.task_name.value, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.