zaquestion / lab

Lab wraps Git or Hub, making it simple to clone, fork, and interact with repositories on GitLab
https://zaquestion.github.io/lab
Creative Commons Zero v1.0 Universal
1.11k stars 102 forks source link

constrain gitlab API calls with context #875

Closed sding3 closed 1 year ago

sding3 commented 1 year ago

Lab previously would appear to be hung if a gitlab API request is in-flight and the user wants to cancel the command with control-C. Now we set up a context whose cancellation is tied to os.Interrupt and this context is used in API requests with gitlab.

Lab previously ignored error in loading custom CA cert. Now that error is bubbled back into main and reported back to the user.

sding3 commented 1 year ago

@prarit - would you be able to review this MR? Also, there seems to be something wrong with CI. I opened #876, which is an empty MR, and you can see CI is failing on that one as well.

prarit commented 1 year ago

My apologies @sding3 , I got a little bit distracted with my day-to-day job :) I've fixed the test failures. Can you rebase and repush?

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 73.68% and project coverage change: +0.17% :tada:

Comparison is base (f4cc7b5) 55.52% compared to head (8cd7ef2) 55.70%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #875 +/- ## ========================================== + Coverage 55.52% 55.70% +0.17% ========================================== Files 82 82 Lines 5972 5953 -19 ========================================== Hits 3316 3316 + Misses 2367 2349 -18 + Partials 289 288 -1 ``` | [Files Changed](https://app.codecov.io/gh/zaquestion/lab/pull/875?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zaq%3F+Wiedmann) | Coverage Δ | | |---|---|---| | [internal/gitlab/gitlab.go](https://app.codecov.io/gh/zaquestion/lab/pull/875?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zaq%3F+Wiedmann#diff-aW50ZXJuYWwvZ2l0bGFiL2dpdGxhYi5nbw==) | `8.10% <73.68%> (-0.24%)` | :arrow_down: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/zaquestion/lab/pull/875/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zaq%3F+Wiedmann)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.