Skip to content
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

Up: teardown when command context is cancelled #11292

Merged
merged 2 commits into from
Jan 2, 2024

Commits on Dec 22, 2023

  1. Fix cancellable context detection in AdaptCmd

    `AdaptCmd` was previously checking for a `.WithCancel` suffix
    on context strings, however it's possible for a context to be
    cancellable without ending in that suffix, such as when
    `context.WithValue` was called after `WithContext`, e.g.:
    
    ```go
    context.Background.WithCancel.WithValue(type trace.traceContextKeyType,
    val <not Stringer>).WithValue(type api.DryRunKey, val <not Stringer>)
    ```
    
    Signed-off-by: Laura Brehm <laurabrehm@hey.com>
    laurazard committed Dec 22, 2023
    Configuration menu
    Copy the full SHA
    ce5a0c6 View commit details
    Browse the repository at this point in the history

Commits on Dec 23, 2023

  1. up: gracefully teardown when command ctx cancelled

    Previously, if a long-lived plugin process (such as
    an execution of `compose up`) was running and then
    detached from a terminal, signalling the parent CLI
    process to exit would leave the plugin process behind.
    
    To address this, changes were introduced on the CLI side
    (see: docker/cli#4599) to enable
    the CLI to notify a running plugin process that it should
    exit. This makes it so that, when the parent CLI process
    is going to exit, the command context of the plugin
    command being executed is cancelled.
    
    This commit takes advantage of these changes by tapping into
    the command context's done channel and using it to teardown
    on an up.
    
    Signed-off-by: Laura Brehm <laurabrehm@hey.com>
    laurazard committed Dec 23, 2023
    Configuration menu
    Copy the full SHA
    dcbf005 View commit details
    Browse the repository at this point in the history