Add Github API endpoint to be used for automatically linking PRs to bug attachments
Categories
(bugzilla.mozilla.org :: API, enhancement)
Tracking
()
People
(Reporter: dkl, Assigned: dkl)
References
Details
Attachments
(1 file)
- Add a new API endpoint that takes data from Github webhook when PR is created/updated
- Parse description for bug id and create a new attachment to a bug with link to PR
- Use shared secret for allowing access to endpoint. Store as a param.
- Use regex for determining bug id similar to other tools (moz-phab)
- If bug id changes, obsolete attachment on old bug and create new attachment on the new bug similar to phab-bot
Assignee | ||
Comment 1•3 years ago
|
||
Assignee | ||
Comment 2•3 years ago
|
||
Comment 3•3 years ago
|
||
Hi [:dkl], Thank you for implementing this so quickly! This is super helpful for us. We would like to set this up for https://github.com/mozilla-mobile/firefox-android. Do you have any pointers / instructions on how to do that? :)
Assignee | ||
Comment 4•3 years ago
|
||
(In reply to Christian Sadilek [:csadilek] from comment #3)
Hi [:dkl], Thank you for implementing this so quickly! This is super helpful for us. We would like to set this up for https://github.com/mozilla-mobile/firefox-android. Do you have any pointers / instructions on how to do that? :)
Welcome. It is not yet rolled out to production yet, just merged to our main branch in Github. We normally do prod deployments on Tuesdays so hopefully this will be live tomorrow.
But when it is you will just need to create a webhook in your repo that contains the correct API endpoint and shared secret key. The endpoint will be https://bugzilla.mozilla.org/rest/github/pull_request
. The secret I will need to provide to you in a secure manner such as gpg or other.
Assignee | ||
Comment 5•3 years ago
|
||
(In reply to Christian Sadilek [:csadilek] from comment #3)
Hi [:dkl], Thank you for implementing this so quickly! This is super helpful for us. We would like to set this up for https://github.com/mozilla-mobile/firefox-android. Do you have any pointers / instructions on how to do that? :)
This is live now in production.So now we just need to get you the shared secret key that you can configure for the webhook. What would be the best way to get that to you? Make sure the webhook uses https://bugzilla.mozilla.org/rest/github/pull_request
and activated on pull request changes only.
Comment 6•3 years ago
|
||
Thanks, we've exchanged the secret and set up the webhook now for PR changes.
Assignee | ||
Comment 7•3 years ago
|
||
Official docs til I find a place to put them:
- From the repo main page, click on the Settings tab.
- Click on Webhooks from the left side menu.
- Click on Add Webhook from the top right.
- For the payload url, enter
https://bugzilla.mozilla.org/rest/github/pull_request
- Choose
application/json
for the content type. - You will need to enter the signature secret obtained from a BMO admin
- Make sure Enable SSL is on.
- Select "Let me select individual events" and only enable "Pull Requests".
- Make sure at the bottom that "Active" is checked on.
- Save the webhook.
Note: Past pull requests will not automatically get a link in the bug created unless an edit event occurs on those older pull requests at some point. New pull requests should get the link when first created.
Additional Note: The API endpoint looks at the pull request title for the bug id so make sure the title is formatted correctly to allow the bug id to be determined.
Assignee | ||
Comment 8•3 years ago
|
||
(In reply to David Lawrence [:dkl] from comment #7)
Official docs til I find a place to put them:
The official docs are now located at https://bmo.readthedocs.io/en/latest/api/core/v1/github.html
Description
•