-
Notifications
You must be signed in to change notification settings - Fork 11
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 regression when compose name is specified #500
Conversation
0ccab28
to
dcd5e6c
Compare
@@ -96,7 +97,7 @@ func getDefaultProjectOptions(workingDir string, extraOpts ...cli.ProjectOptions | |||
// get compose file path set by COMPOSE_FILE | |||
cli.WithConfigFileEnv, | |||
// if none was selected, get default compose.yaml file from current dir or parent folder | |||
cli.WithDefaultConfigPath, | |||
// cli.WithDefaultConfigPath, NO: this ends up picking the "first" when more than one file is found |
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.
Here is the link:
https://github.com/compose-spec/compose-go/blob/9d0d133e13d0955e27520c6317d08822b7c5de5f/cli/options.go#L165
Should we keep it consistent though?
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.
LGTM
Fixes #509 In #500, we were concerned that the presence of both a `compose.yaml` and ` docker-compose.yaml` file could be confusing, so we decided to return an error and exit early. However, `compose-go` _does_ log out a warning in this scenario, as does `docker compose`. We've changed our mind and decided to aim for closer parity with docker here by reverting to logging the warning and continuing with `compose.yaml`. While implementing this, in an effort to bring us to closer parity with docker compose, we decided to go ahead and add support for passing `-f` multiple times—adding support for multiple compose files. - [x] Add support for multiple compose files with `-f`. - [x] Modify `compose.LoadCompose` to leverage the `compose-go` library to find default compose file paths if one isn't passed explicitly. - [x] Avoid returning an error if multiple default compose files are found. `compose-go` will always pick `compose.yaml` over `docker-compose.yaml`. It will also log a warning message explaining this to stderr. - [x] Remove `toomany` test case since there is nothing meaningful to test anymore. - [x] Add a simple test at the command level for something like `defang version` to make sure it doesn't try to load a compose file during intialization. In time, we should add command-level tests for everything with a mock server. - [x] lazily verify compose path, to avoid requiring it for commands like `defang version` which do not use it.
also adds a new
toomany
test case to test the case when there are more than 1 compose files in a folder