Open
Conversation
Contributor
Williambraecky
commented
Feb 26, 2025
- Use webhook secrets with github (optional)
- Store webhooks to be processed by the leader
- automagically match prs with runbot errors if the pr_body contains the appropriate content
xmo-odoo
reviewed
May 28, 2025
runbot/models/branch.py
Outdated
Comment on lines
+98
to
+103
| pr_body_regex = r'^.*runbot.*error[^\d]*(\d+)[ \S]*\r?$' | ||
| error_ids = re.findall( | ||
| pr_body_regex, | ||
| self.pr_body, | ||
| re.IGNORECASE | re.MULTILINE | ||
| ) |
Collaborator
There was a problem hiding this comment.
I think the regex can be simplified to this:
Suggested change
| pr_body_regex = r'^.*runbot.*error[^\d]*(\d+)[ \S]*\r?$' | |
| error_ids = re.findall( | |
| pr_body_regex, | |
| self.pr_body, | |
| re.IGNORECASE | re.MULTILINE | |
| ) | |
| pr_body_regex = | |
| error_ids = re.findall( | |
| r'\brunbot.*error.*?(\d+)', | |
| self.pr_body, | |
| re.IGNORECASE | re.ASCII | |
| ) |
- there's no reason to limit the pattern to one match per line
\d+is greedy so there's no need to end it with something wonky, especially not "space or non-whitespace"- no idea why
\ris even there - by default re will consider e.g.
២to be a valid\d, which probably isn't desirable here
xmo-odoo
reviewed
May 28, 2025
| ]) | ||
| errors.fixing_pr_id = self | ||
| for error in errors: | ||
| error.message_post(body='Fixing pr automatically set through PR message') |
Collaborator
There was a problem hiding this comment.
Might be useful to log the user triggering this, and also maybe to first check that the author of the PR is a known / internal user to avoid abuse (as anyone can create a PR)
fb9861c to
16b37a2
Compare
97caf80 to
2c82db7
Compare
Use github secret and header verification to validate that the sender is indeed github.
Decouples the hook processing from the controller, this ensures that latency for the controller stays low while allowing more complex logic during hook handling.
Automatically link the pr with the build error if it contains anything
along the lines of `runbot.*error.*{id}`.
Among the changes:
- Add a path for the build error act_window so that it include
runbot-error
- Fix the widget for `pr_body` in branch form view to use `text`
instead of char as they are most likely multi line string.
2c82db7 to
41f9cd0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.