-
Notifications
You must be signed in to change notification settings - Fork 255
Fix --project-directory mix with --workdir #1353
Conversation
Signed-off-by: Ulysses Souza <[email protected]>
@@ -41,8 +41,7 @@ func (o *projectOptions) addProjectFlags(f *pflag.FlagSet) { | |||
f.StringVarP(&o.ProjectName, "project-name", "p", "", "Project name") | |||
f.StringArrayVarP(&o.ConfigPaths, "file", "f", []string{}, "Compose configuration files") | |||
f.StringVar(&o.EnvFile, "env-file", "", "Specify an alternate environment file.") | |||
f.StringVar(&o.WorkingDir, "workdir", "", "Specify an alternate working directory") | |||
// TODO make --project-directory an alias | |||
f.StringVar(&o.ProjectDir, "project-directory", "", "Specify an alternate working directory\n(default: the path of the Compose file)") |
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.
unfortunately we can't just break existing usage on ACI/ECS like this I think, we'll need to keep workdir an alias of this flag (confusing with the exec one I agree, but... we can put project-directory in front more visible of course, just support running with the --workdir alias)
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.
I understand it's a breaking change, but that's actually a bug fix.
The problem is that in the case of exec
and run
we can use both at the same time. So in this case it's broken.
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.
Don't remove --workdir
or we will break ECS/ACI use (whihc is G.A., we can't just change our mind like this). Make it a hidden flag, warn user about deprecated attribute and use of --project-directory
This also checks for conflicts with --project-directory at `docker compose` command level Signed-off-by: Ulysses Souza <[email protected]>
This fixes the ambiguity between
--project-directory
and--workdir
--project-directory
is the one passed tocompose-go
to resolve compose files--workdir
is passed to commandsrun
andexec
to provide $PWD to the container before running the command.Resolves #1279