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 "extends" same file optimization #6425

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@amezin
Copy link

commented Dec 21, 2018

Resolves #6424

amezin added some commits Dec 21, 2018

Add test to verify same file 'extends' optimization
Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
Fix same file 'extends' optimization
Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
@shin-
Copy link
Contributor

left a comment

Needs one small change, otherwise LGTM

@@ -593,7 +593,7 @@ def validate_and_construct_extends(self):
config_path = self.get_extended_config_path(extends)
service_name = extends['service']

if config_path == self.config_file.filename:
if config_path == os.path.abspath(self.config_file.filename):

This comment has been minimized.

Copy link
@shin-

shin- Dec 28, 2018

Contributor

I think this'd need to be expand_path(self.working_dir, self.config_file.filename) instead to correctly handle cases where working_dir is not .

This comment has been minimized.

Copy link
@amezin

amezin Jan 5, 2019

Author

Not sure what exactly working_dir means and where does it come from, but I've tried:

  • adding override_dir to load_from_filename in the test - still passes
  • moving docker-compose.yml into a subdirectory and running $ docker-compose -f subdir/docker-compose.yml - the optimization still works

In the latter case, self.working_dir is /abs/path/to/subdir, and self.config_file.filename is ./subdir/docker-compose.yml, so, I think, expand_path won't produce a correct path.

This comment has been minimized.

Copy link
@amezin

This comment has been minimized.

Copy link
@ulyssessouza

ulyssessouza Jan 25, 2019

Collaborator

@amezin is right in the sense that expand_path(self.working_dir, self.config_file.filename) does not pass the tests.

@rumpl @chris-crone

@shin- shin- added this to the 1.24.0 milestone Dec 28, 2018

@shin- shin- removed this from the 1.24.0 milestone Jan 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.