-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Refactor [Codecov] #3074
Refactor [Codecov] #3074
Conversation
|
I'm having a little difficulty with the redirect around inserting the token query param after the extension. I.e. we want to redirect the old path: to: but right now my redirect is currently being sent to: Is there a way in the redirect service definition target to specify new/additional query params? I'm not seeing a way to do that in the current If anyone knows of a way to specify new/additional query params on the target please let me know! |
It definitely doesn't do that yet! 😁 I'd probably suggest adding a second function like I have a couple changes to |
That's exactly what I was thinking too! I had started with renaming Let me know if I can be of any help with the |
So… that PR got big (#3093). 😝 If you want I could pick out the redirector validation bits, which probably could be reviewed separately, much quicker. |
I'd say don't worry about pulling that out. Happy to wait til #3093 gets merged |
I'm going to take a stab at updating the redirector function to support transforming query params (assuming you aren't already working on it/finished it @paulmelnikow) |
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 one!
Co-Authored-By: calebcartwright <calebcartwright@users.noreply.github.com>
@calebcartwright Let me know if you want anything else from me before merging! |
@paulmelnikow sorry I should've left a comment. I want to spend a bit more time challenging the schema in relation to the API response as I thought of a couple other scenarios. Will also add a couple of the code comments we've discussed in this thread Will give you a shout when I'm done |
Alrighty, I created some sample apps and ran through some various scenarios and concluded the schema is best as-is 👍 @paulmelnikow - I'm all set here now |
This is ready for review now
Couple notes (more detailed versions below):
Still a work in progress, but opening this as a draft PR to start a dialog on a few itemstoken
parameterThe legacy service supported coverage badges for private repos via a user-supplied token in a route param. Typical/public repo pattern was
codecov/c/:vcs/:user/:repo
, for private repos the user adds/token/:token
before the vcs param:codecov/c/token/:token/:vcs/:user/:repo
. I was thinking it would be easier if the token was supplied via a query param (codecov/c/:vcs/:user/:repo?token=
) vs. trying to keep the optional token in the route and having to useformat/capture
. I figured I could then create a redirect service for the token route to maintain backwards compatibility. Thoughts?The legacy service was using Codecov's native badge (https://codecov.io/gh/codecov/example-python/graphs/badge.svg) with plain text (https://codecov.io/gh/codecov/example-python/graphs/badge.txt). Codecov has a documented REST API for the data we need (https://docs.codecov.io/reference#section-get-a-single-repository) that returns a friendly JSON object, so I've switched to that. Any concerns there?
The Codecov UI displays the exact coverage value, but their badges display coverage rounded down to the integer value (90.98% coverage shows as 90%), and that integer value is what our legacy service implementation saw and rendered. The Codecov API returns the precise coverage value (i.e. the 90.98%) so we've now got the option to either continue the Math.floor approach and be consistent with the native Codecov badges, or we could apply the same rounding that we do on other Shields coverage badges (90.98% would show as 91%) I went with the latter in the refactored service, but let me know if anyone thinks we should switch back to rounding down
Note: I've intentionally left the legacy service content in place (renamed) while this PR is in draft mode for easier side-by-side comparisons, but of course will remove it