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

Fix: Warning Message and Fallback search #1140

Merged
merged 1 commit into from
Jul 27, 2018
Merged

Fix: Warning Message and Fallback search #1140

merged 1 commit into from
Jul 27, 2018

Conversation

Vimal-Raghubir
Copy link
Contributor

- What I did
fixes: #1110 . I removed the usage of the $HOME environment variable when the CLI searches for the .dockercfg file and changed it to use the $DOCKER_CONFIG variable as it should be doing in the first place.

Next I changed the return statements for the error messages to display the new file path which is represented by the variable filename, instead of the old config file path indicated by confFile.
- How I did it

I scanned the function calls and noticed the usage of homedir.Get() for the $HOME variable. This was easy to realize that this has to be changed to the $DOCKER_CONFIG variable. After that I scanned the error messages that used this old file path and realized confFile renders the old file path. This had to be replaced with filename which represents the new file path.
- How to verify it

Verifying this can be done by rerunning the steps to reproduce the initial issue linked earlier. The warning message should be changed as well as the search should be done using the $DOCKER_CONFIG variable instead of the $HOME variable.
- Description for the changelog

Fix warning message and ensure fallback search uses the DOCKER_CONFIG variable.

- A picture of a cute animal (not mandatory but encouraged)
pug

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Vimal-Raghubir for this PR!
LGTM, but can you update update your commit message with a sign-off as described here ?

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a comment inline @silvin-lubecki @vdemeester PTAL

@@ -90,18 +90,18 @@ func Load(configDir string) (*configfile.ConfigFile, error) {
}

// Can't find latest config file so check for the old one
confFile := filepath.Join(homedir.Get(), oldConfigfile)
confFile := filepath.Join(configDir, oldConfigfile)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is actually correct; custom locations for the configuration file were added in moby/moby#12856, but at that time, .dockercfg was already the old file, and replaced with ~/.docker/config.json (that change was made in moby/moby#12009)

If we change this now, we're effectively adding new functionality (don't think setting --config-dir=/foo would read /foo/.dockercfg in older versions, correct? For a deprecated feature.

I think we should print a deprecation warning if we encounter an ~/.dockercfg file, and remove the logic to look for this filename in the next release (or the one after); this needs to be added to the deprecated features document; https://github.com/docker/cli/blob/master/docs/deprecated.md

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree with @thaJeztah on this. This part of the code is looking for older/deprecated configuration file that was hardcoded in $HOME/.dockercfg… So we shouldn't change that (otherwise we're effectively adding a new functionnality).

@docker docker deleted a comment from GordonTheTurtle Jun 28, 2018
Copy link
Collaborator

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as @thaJeztah, I think we should deprecate and remove the code in later releases.

@@ -90,18 +90,18 @@ func Load(configDir string) (*configfile.ConfigFile, error) {
}

// Can't find latest config file so check for the old one
confFile := filepath.Join(homedir.Get(), oldConfigfile)
confFile := filepath.Join(configDir, oldConfigfile)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree with @thaJeztah on this. This part of the code is looking for older/deprecated configuration file that was hardcoded in $HOME/.dockercfg… So we shouldn't change that (otherwise we're effectively adding a new functionnality).

@Vimal-Raghubir
Copy link
Contributor Author

Thank you @thaJeztah and @vdemeester for your review and feedback! So based on my understanding to your comments, this file path search has to be deprecated and removed eventually?

The reason why I am asking this is I would love to help with the deprecation and removal of this portion if you wish to explore it anytime soon.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but can you squash your commits?

Let me know if you need help / instructions for that

@Vimal-Raghubir
Copy link
Contributor Author

Vimal-Raghubir commented Jun 28, 2018

Would I need to run the commands shown above by @GordonTheTurtle then run the squash commands? I small bit of help with this would be much appreciated. Thank you.

@thaJeztah
Copy link
Member

Whoops, sorry, missed your ping; so to squash the commits, you do an "interactive rebase"; when doing an interactive rebase, you can mark commits to be "squashed" together. Here are some instructions that may help; https://docs.docker.com/v1.12/opensource/workflow/work-issue/#/pull-and-rebase-frequently.

Make sure that the commit after it's been squashed is signed-off as well; if you forgot to do so, you can amend your commit with docker commit -s --amend

If all is done, you need to force push your branch (needed, because you did a rebase), which will update the pull request

Signed-off-by: Vimal-Raghubir <[email protected]>
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah
Copy link
Member

rebased and squashed; @vdemeester PTAL

@Vimal-Raghubir
Copy link
Contributor Author

Hi @thaJeztah,
Any update on this PR? Thank you.

@docker docker deleted a comment from GordonTheTurtle Jul 27, 2018
Copy link
Collaborator

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐯

@vdemeester vdemeester merged commit a3464c0 into docker:master Jul 27, 2018
@GordonTheTurtle GordonTheTurtle added this to the 18.09.0 milestone Jul 27, 2018
@Vimal-Raghubir Vimal-Raghubir deleted the 1110-Fix-Warning-Message branch July 27, 2018 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid DOCKER_CONFIG should warn using the current config pattern
5 participants