-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat: global signal handling to cancel ctx for graceful exits #4993
Conversation
8e2f328
to
13e4776
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4993 +/- ##
==========================================
+ Coverage 61.37% 61.83% +0.46%
==========================================
Files 298 298
Lines 20717 20736 +19
==========================================
+ Hits 12715 12823 +108
+ Misses 7102 7000 -102
- Partials 900 913 +13 |
Thinking about this now, maybe I should just do this top-level inside the |
63a2225
to
47b6915
Compare
47b6915
to
7ffda3e
Compare
This PR is blocked by moby/moby#47536. The cobra context isn't given to the prompt function when Also need to update and merge #4774 |
Looks like the linter's complaining, and some tests are broken because now the output from the graceful termination logic is different:
I think it should be fine to hardcode the I guess we'll hold off on merging this one since it needs changes to moby that we want to get in after 26.1, so we can get it in after we cut a release. |
Ah yeah, the tests won't pass right now. Not without the changes to moby and context passing in CLI. I'll hardcode the |
7ffda3e
to
743fc70
Compare
8b74c89
to
79fdc57
Compare
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.
LGTM overall, but looks like there's some tests failing/linters complaining. I wonder if were doing things correctly with those deferred cancel()
s in main
.
I have been looking into it. I've fixed one of the tests, specifically the plugins e2e signal handling and still busy on the containers e2e |
Wondering why this test is failing on the |
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.
overall LGTM, just a couple minor comments
39f4f3e
to
fbbc83e
Compare
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.
re-LGTM
@vvoland can you take another look and then I'll merge? |
e5f3765
to
a9b8be1
Compare
Signed-off-by: Alano Terblanche <[email protected]>
a9b8be1
to
3f0d90a
Compare
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.
LGTM
Since other repositories import from the CLI, the signal termination handling done inside the
PromptForConfirmation
could cause problems for the third party repositories. Thus this PR hoists the signal termination out of thePromptForConfirmation
function.- What I did
Hoist the signal handling from the
PromptForConfirmation
function to the more appropriate top-level functionrunDocker
.- How I did it
Using the
signal
package I catch context cancellations as well as termination signals then pass the returned context to cobra'sExecute
method.- How to verify it
Tests
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)