-
Notifications
You must be signed in to change notification settings - Fork 28
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
gitlab oauth scope setting #613
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. 📢 Thoughts on this report? Let us know! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #613 +/- ##
=======================================
Coverage 91.46% 91.46%
=======================================
Files 615 615
Lines 16363 16367 +4
=======================================
+ Hits 14966 14970 +4
Misses 1397 1397
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found @@ Coverage Diff @@
## main #613 +/- ##
=======================================
Coverage 91.46% 91.46%
=======================================
Files 615 615
Lines 16363 16367 +4
=======================================
+ Hits 14966 14970 +4
Misses 1397 1397
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #613 +/- ##
===========================================
Coverage 95.91000 95.91000
===========================================
Files 793 793
Lines 17680 17684 +4
===========================================
+ Hits 16958 16962 +4
Misses 722 722
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
codecov_auth/views/gitlab.py
Outdated
@@ -40,11 +41,16 @@ def get_url_to_redirect_to(self): | |||
redirect_info = self.redirect_info | |||
base_url = urljoin(redirect_info["repo_service"].service_url, "oauth/authorize") | |||
state = self.generate_state() | |||
|
|||
scope = get_config("gitlab_scopes", default="api") |
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.
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.
Trying not to set scopes like this is because this would get parsed as a list when parsing yaml file while when we set the scopes as env var it would be parsed as a string, so don't want to check for both string and list types at run time. So I'm just using a space separated string for setting the scope, setting the env var would be like GITLAB__SCOPE='api read_repository'
codecov_auth/views/gitlab.py
Outdated
@@ -40,11 +41,16 @@ def get_url_to_redirect_to(self): | |||
redirect_info = self.redirect_info | |||
base_url = urljoin(redirect_info["repo_service"].service_url, "oauth/authorize") | |||
state = self.generate_state() | |||
|
|||
scope = get_config("gitlab_scopes", default="api") |
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.
Let's add this config it to settings base, and use it in redirect info, it's easier to tweak/follow convention here
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.
Moved.
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.
Looks good to me. One thing i would add is a test where we mock settings variable and make sure it's sent in the request. Not gonna let it block the PR though as i tested things locally.
Test locally with adding
gitlab_scope
to theconfig/codecov.yml
file in umbrella-hat.Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.