Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Fix --project-directory mix with --workdir #1353

Merged
merged 2 commits into from
Mar 1, 2021

Conversation

ulyssessouza
Copy link
Contributor

@ulyssessouza ulyssessouza commented Feb 25, 2021

This fixes the ambiguity between --project-directory and --workdir

--project-directory is the one passed to compose-go to resolve compose files
--workdir is passed to commands run and exec to provide $PWD to the container before running the command.

Resolves #1279

@github-actions github-actions bot added cli cli local Local context (moby) labels Feb 25, 2021
@@ -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)")
Copy link
Contributor

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)

Copy link
Contributor Author

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.

Copy link
Collaborator

@ndeloof ndeloof left a 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]>
@ulyssessouza
Copy link
Contributor Author

ulyssessouza commented Mar 1, 2021

PTAL @ndeloof @gtardif

@ndeloof ndeloof merged commit dd843bd into docker-archive:main Mar 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cli cli local Local context (moby)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support compose common flag --project-directory
3 participants