-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat: Add list repo tokens endpoint #97007
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
Conversation
Retrieves a paginated list of repository tokens for a given owner. | ||
""" | ||
|
||
navigation = request.query_params.get("navigation", NavigationParameter.NEXT.value) |
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.
could we use a serializer to format the query parameters? e.g.
serializer = AuditLogQueryParamSerializer(data=request.GET) |
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.
Definitely on our list to clean up and create some consolidated serializers once we have a working beta; things are a little too flexible to commit to something outright just yet
|
||
navigation = request.query_params.get("navigation", NavigationParameter.NEXT.value) | ||
limit_param = request.query_params.get("limit", MAX_RESULTS_PER_PAGE) | ||
cursor = request.query_params.get("cursor") |
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.
it it possible to use our standardized pagination, like in other sentry endpoints?
- https://docs.sentry.io/api/pagination/
sentry/src/sentry/api/paginator.py
Line 243 in 40ccecb
class OffsetPaginator(PaginatorLike): - paginator classes here, are any of them suitable for your use case?
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.
Unfortunately not, we've taken the approach to use Codecov's GQL paginator directly to avoid any additional hacks and bandages we might need to cut through and/or workaround. Its just a lot simpler for us this way
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #97007 +/- ##
==========================================
- Coverage 80.68% 80.11% -0.57%
==========================================
Files 8496 8498 +2
Lines 374236 379507 +5271
Branches 24287 24287
==========================================
+ Hits 301940 304040 +2100
- Misses 71919 75090 +3171
Partials 377 377 |
token = serializers.CharField() | ||
|
||
|
||
class RepositoryTokensSerializer(serializers.Serializer): |
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 generally try to standardize on using a sentry response serializer, which can then work with our paginator classes. https://develop.sentry.dev/backend/api/serializers/#model-serializer.
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.
Nice!
This PR aims to add the list tokens endpoint for showing all the repo tokens for a particular organization. Closes https://linear.app/getsentry/issue/CCMRG-1310/create-list-endpoint-for-repository-tokens Depends on codecov/umbrella#371 which adds a new "token" property to the repository resolver which bypasses some other checks we have on the uploadToken endpoint. I didn't want to make the modifications to the uploadToken endpoint directly because then Gazebo would probably break and/or it'd just look really hacky. Follows similar conventions to the list repositories endpoint, just a slightly different GQL query <img width="974" height="771" alt="Screenshot 2025-08-01 at 1 29 02 PM" src="https://github.com/user-attachments/assets/7b943e90-1912-4b2b-a07d-7ec63cff8374" /> Hiding all the token info for privacy <!-- Sentry employees and contractors can delete or ignore the following. --> ### 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. and is gonna need some rights from me in order to utilize my contributions in this here 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.
…token table (#97095) This PR aims to create the hook for the new repo token list endpoint as well as the pagination stuff for us to swap between pages in the repo token table. We also remove the createdAt stuff from the token regen table since that doesn't exist on the codecov side. So there are a couple styling updates there to reflect that too. Follows similar conventions to #96228 Depends on #97007 Closes https://linear.app/getsentry/issue/CCMRG-1482/hook-up-list-endpoint Closes https://linear.app/getsentry/issue/CCMRG-1443/drop-column-for-token-creation-date <img width="1070" height="851" alt="Screenshot 2025-08-04 at 10 58 32 AM" src="https://github.com/user-attachments/assets/1cdac64e-2d6b-4118-aaff-6f61f1380738" /> <!-- Sentry employees and contractors can delete or ignore the following. --> ### 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. and is gonna need some rights from me in order to utilize my contributions in this here 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.
…token table (#97095) This PR aims to create the hook for the new repo token list endpoint as well as the pagination stuff for us to swap between pages in the repo token table. We also remove the createdAt stuff from the token regen table since that doesn't exist on the codecov side. So there are a couple styling updates there to reflect that too. Follows similar conventions to #96228 Depends on #97007 Closes https://linear.app/getsentry/issue/CCMRG-1482/hook-up-list-endpoint Closes https://linear.app/getsentry/issue/CCMRG-1443/drop-column-for-token-creation-date <img width="1070" height="851" alt="Screenshot 2025-08-04 at 10 58 32 AM" src="https://github.com/user-attachments/assets/1cdac64e-2d6b-4118-aaff-6f61f1380738" /> <!-- Sentry employees and contractors can delete or ignore the following. --> ### 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. and is gonna need some rights from me in order to utilize my contributions in this here 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.
This PR aims to add the list tokens endpoint for showing all the repo tokens for a particular organization.
Closes https://linear.app/getsentry/issue/CCMRG-1310/create-list-endpoint-for-repository-tokens
Depends on codecov/umbrella#371 which adds a new "token" property to the repository resolver which bypasses some other checks we have on the uploadToken endpoint. I didn't want to make the modifications to the uploadToken endpoint directly because then Gazebo would probably break and/or it'd just look really hacky.
Follows similar conventions to the list repositories endpoint, just a slightly different GQL query
Hiding all the token info for privacy
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. and is gonna need some rights from me in order to utilize my contributions in this here 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.