Fix relative paths on envfile label#9422
Conversation
|
|
||
| ef := o.EnvFile | ||
| if ef != "" && !filepath.IsAbs(ef) { | ||
| ef = filepath.Join(project.WorkingDir, o.EnvFile) |
There was a problem hiding this comment.
I'm not sure I understand the intent here. afaict filepath.Join(project.WorkingDir, o.EnvFile) should already make this path absolute, but maybe I missed something?
could you please clarify this in your PR description as the Docker Desktop issue is not public
There was a problem hiding this comment.
In the example where:
/some/pathis where we execute the command/some/path/wrkdiris the path passed as--project-directory./wrkdir/envs/my.envas the path passed in--env-file
in this we would end with /some/path/wrkdir + ./wrkdir/envs/my.env which would repeat wrkdir resulting in /some/path/wrkdir/wrkdir/envs/my.env which is wrong.
There was a problem hiding this comment.
ah ok, because we resolve envfile based on project dir (which is definitely a bug) and we should resolve relative to command working dir. Then filepath.Abs is relevant. Earlier version of the diff I reviewed was doing some voodoo magic with WorkingDir so my confusion
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
47254db to
4ca5b8d
Compare
What I did
This harmonizes the absolute path of project's working dir with the possible relative path of the env-file
Related issue
Resolves docker/for-mac#6229
(not mandatory) A picture of a cute animal, if possible in relation with what you did