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
Use github api for osg-bot PR interaction (SOFTWARE-3564) #444
Use github api for osg-bot PR interaction (SOFTWARE-3564) #444
Conversation
For @matyasselmeci and @brianhlin, New osg-bot PR comments: non-dt pr: #450 (no osg-bot message) ... and, do we wanna add the help@ email always, or only on failures? |
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
we only want to allow 'merge', which is the default, not 'squash' or 'rebase'. (SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
sendit! sendat comment! (SOFTWARE-3564)
(SOFTWARE-3564)
...required rearranging status_hook a bit... (SOFTWARE-3564)
... if this all works, we'll strip out the stuff to generate the merge commit, and maybe the mailx stuff too (SOFTWARE-3564)
(SOFTWARE-3564)
which probably belong in the github module... but one step at a time (SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
note we also dropped 👍 for mat (SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
if gh_api_user/token aren't configured, this will just be an empty call (SOFTWARE-3564)
put validate_request_signature next to validate_webhook_signature (SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
status sender is the ci job owner, which is always derek (SOFTWARE-3564)
(SOFTWARE-3564)
(SOFTWARE-3564)
fe74251
to
03fb462
Compare
The force-push just now was a rebase to tidy up git history a bit, no content changes. This is currently working on topology-itb and will only make at most a single PR comment, rather than the multiple seen in previous iterations. |
(SOFTWARE-3564)
"Unexpected merge failure!\n" | ||
"\n" | ||
"{fail_message}\n" | ||
"\n" |
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.
We should express that OSG staff will investigate this issue
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.
Updated
import glob | ||
import hmac | ||
import logging | ||
import os | ||
import re | ||
import subprocess | ||
from subprocess import PIPE | ||
from subprocess import PIPE |
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.
Errant whitespace change
from subprocess import PIPE | |
from subprocess import PIPE |
(SOFTWARE-3564) Co-Authored-By: edquist <edquist@users.noreply.github.com>
(SOFTWARE-3564)
@matyasselmeci, @brianhlin, lmk if you have anything further for this |
src/webapp/github.py
Outdated
def github_api_call(self, method, url, data): | ||
if data is not None: | ||
data = json.dumps(data).encode() | ||
req = urllib.request.Request(url, data) |
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.
Does doing req = urllib.request.Request(url, data, method=method)
not work? Then you wouldn't have to use a lambda below.
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.
How about that.
In python2, urllib2.Request
(which python3 moved to urllib.request.Request
), the __init__
method did not take a method
parameter, and it was somewhat annoyingly required that req.get_method
be set to a function that would return the method to be used. Thus the lambda.
I didn't realize they added a method parameter. Apparently this was added in Python 3.3.
So, while this github_api_call
goes about things in a way that is also python2 compatible, yeah it looks cleaner to just pass in a method
parameter to Request
, since we only care about python3.6+.
Feel free to merge once you've brought the branch up to date. |
Apparently in python3.3+, Request takes a method parameter, rather than needing to provide a get_method function. And since we only care about python3.6+, we might as well just do that. Suggested by Mat. (SOFTWARE-3564)
Since we have @osg-bot now; the webhook app can use an access token for the github api to make comments directly on PRs, rather than emailing a select list.
Also, @osg-bot can hit the big green Merge button directly with the github api, rather than the webhook app needing to generate and push a merge commit manually with an ssh key.
This is currently functional on topology-itb, though i'm marking this PR
WIP
, as there was already some feedback about things that can be improved (#436), and i'm sure i'll want to clean up this branch before merging it.