Skip to content
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

Adding Github backend #1

Closed
wants to merge 20 commits into from
Closed

Adding Github backend #1

wants to merge 20 commits into from

Conversation

EduardGomezEscandell
Copy link
Contributor

@EduardGomezEscandell EduardGomezEscandell commented Jul 8, 2022

Reports bugs as Github Issues to a given repository. This is done with Ubuntu WSL in mind, but can be easily adapted for other purposes.

Authentication

Uses Github's Device flow:
https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps#device-flow

This means that the user is given this message:

Input the following code in your browser:
URL: https://github.com/login/device
Code: B45A-7491

And this is used to authenticate.

@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2022

Codecov Report

Merging #1 (7a9f870) into main (a9f9593) will decrease coverage by 0.66%.
The diff coverage is 1.97%.

@@            Coverage Diff             @@
##             main       #1      +/-   ##
==========================================
- Coverage   79.29%   78.62%   -0.67%     
==========================================
  Files          77       78       +1     
  Lines       17222    17374     +152     
==========================================
+ Hits        13656    13661       +5     
- Misses       3566     3713     +147     
Impacted Files Coverage Δ
apport/crashdb_impl/github.py 0.00% <0.00%> (ø)
etc/apport/crashdb.conf 100.00% <ø> (ø)
apport/ui.py 67.72% <66.66%> (-0.01%) ⬇️
apport/crashdb.py 80.21% <100.00%> (+0.05%) ⬆️
tests/system/test_ui_gtk.py 97.68% <0.00%> (+0.15%) ⬆️
gtk/apport-gtk 77.21% <0.00%> (+0.25%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@EduardGomezEscandell
Copy link
Contributor Author

EduardGomezEscandell commented Jul 27, 2022

Some work left to do:

$ ubuntu-bug python3

First, it fails to find attach_casper_md5check

ERROR: hook /usr/share/apport/general-hooks/ubuntu.py crashed:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/apport/report.py", line 241, in _run_hook
    symb["add_info"](report, ui)
  File "/usr/share/apport/general-hooks/ubuntu.py", line 84, in add_info
    apport.hookutils.attach_casper_md5check(report,
AttributeError: module 'apport.hookutils' has no attribute 'attach_casper_md5check'

Afterwards, when clicking on the github link, it doesn't open, and it shows:

(apport-gtk:1416): Gdk-WARNING **: 09:23:37.764: Server is missing xdg_foreign support

(apport-gtk:1416): Gtk-WARNING **: 09:23:37.765: Unable to show 'https://github.com/login/device': Operation not supported

I can still acces it via Right click > Copy link address.

Finally, the link to the issue, automatically openened at end, is opened via /usr/bin/lynx. I'd like to open it from Windows' side to use Windows' default browser.

@bdrung
Copy link
Collaborator

bdrung commented Jul 27, 2022

Better use requests (it support proxies and stuff). To make the test happy, you have to add python3-requests to .github/workflows/ci.yaml.

@EduardGomezEscandell
Copy link
Contributor Author

Force-pushed after rebasing to catch up to main branch

@EduardGomezEscandell
Copy link
Contributor Author

Status

It works, there as some UX improvements possible but I believe they are best left for a future PR. These include:

  • Opening links on the Windows browser
  • Making the login code copy-paste-able.

Blocking aspects

File etc/apport/crashdb.conf uses a Github App ID linked to my account to talk to the Github API:

'ubuntu-wsl': {
'impl': 'github',
'repository_owner': 'EduardGomezEscandell', # TODO: Change to an Ubuntu account
'repository_name': 'GithubAPI', # TODO: Change to "WSL"
'github_app_id': 'a654870577ad2a2ab5b1', # TODO: Give App ownership to a Canonical github account
'labels': ['apport'],
'distro': 'ubuntu wsl'
},

This has to be changed to an Ubuntu account before this PR is merged (I'm on it)

@EduardGomezEscandell
Copy link
Contributor Author

Closing this PR because this work was taken over in #26.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants