-
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
context use: don't create/update config file and directories if not needed #3721
Conversation
This code was handling validation and parsing, only to discard the results if it was the default context. Signed-off-by: Sebastiaan van Stijn <[email protected]>
6c9c5e8
to
fc7daec
Compare
Codecov Report
@@ Coverage Diff @@
## master #3721 +/- ##
=======================================
Coverage 59.11% 59.11%
=======================================
Files 289 289
Lines 24665 24665
=======================================
Hits 14581 14581
Misses 9212 9212
Partials 872 872 |
cli/command/context/use_test.go
Outdated
cli, err := command.NewDockerCli(command.WithCombinedStreams(io.Discard)) | ||
assert.NilError(t, err) | ||
assert.NilError(t, newUseCommand(cli).RunE(nil, []string{"default"})) | ||
assert.NilError(t, err) |
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.
Redundant last assert
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 catch; sloppy copy/paste 😅
fixed!
…eeded Avoid updating the config-file if nothing changed. This also prevents creating the file and config-directory if the default is used and no config-file existed yet. `config.Save()` performs various steps (creating the directory, updating or copying permissions, etc etc), which are not needed if the defaults are used; https://github.com/docker/cli/blob/a445d97c2536f0de37469d0ea9881288d6c49cbf/cli/config/configfile/file.go#L135-L176 Signed-off-by: Sebastiaan van Stijn <[email protected]>
fc7daec
to
f87d7ed
Compare
All green; let's get this one in |
context use: skip validation for "default" context
This code was handling validation and parsing, only to discard the results if it was the default context.
context use: don't create/update config file and directories if not needed
Avoid updating the config-file if nothing changed. This also prevents creating
the file and config-directory if the default is used and no config-file existed
yet.
config.Save()
performs various steps (creating the directory, updatingor copying permissions, etc etc), which are not needed if the defaults are
used;
cli/cli/config/configfile/file.go
Lines 135 to 176 in a445d97
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)