-
Couldn't load subscription status.
- Fork 153
[IMP] runbot: hooks'n'stuff #1068
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: 18.0
Are you sure you want to change the base?
Conversation
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
runbot/models/branch.py
Outdated
| pr_body_regex = r'^.*runbot.*error[^\d]*(\d+)[ \S]*\r?$' | ||
| error_ids = re.findall( | ||
| pr_body_regex, | ||
| self.pr_body, | ||
| re.IGNORECASE | re.MULTILINE | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the regex can be simplified to this:
| 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
| ]) | ||
| errors.fixing_pr_id = self | ||
| for error in errors: | ||
| error.message_post(body='Fixing pr automatically set through PR message') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
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.
fb9861c to
16b37a2
Compare
b4d247f to
97caf80
Compare
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.
97caf80 to
2c82db7
Compare