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 regression when compose name is specified #500

Merged
merged 1 commit into from
Jun 27, 2024
Merged

Conversation

lionello
Copy link
Member

@lionello lionello commented Jun 25, 2024

also adds a new toomany test case to test the case when there are more than 1 compose files in a folder

@lionello lionello force-pushed the lio-fix-name-override branch from 0ccab28 to dcd5e6c Compare June 25, 2024 21:07
@lionello lionello requested review from edwardrf and nullfunc June 25, 2024 21:09
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@edwardrf edwardrf left a comment

Choose a reason for hiding this comment

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

LGTM

@lionello lionello merged commit f76e458 into main Jun 27, 2024
5 checks passed
@lionello lionello deleted the lio-fix-name-override branch July 13, 2024 17:25
jordanstephens added a commit that referenced this pull request Aug 6, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants