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

always resolve paths relative to extending file's working dir #538

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

ndeloof
Copy link
Collaborator

@ndeloof ndeloof commented Jan 19, 2024

closes docker/compose#11377
closes docker/compose#11379

note: custom resource loaders defined by docker/compose will have to implement Dir(path string) returning (absolute) path for file within the remote download cache

@ndeloof ndeloof marked this pull request as draft January 19, 2024 15:05
@ndeloof ndeloof force-pushed the issue_11377 branch 8 times, most recently from 832de94 to 024ebef Compare January 19, 2024 18:12
@ndeloof ndeloof marked this pull request as ready for review January 19, 2024 18:14
Copy link
Collaborator

@glours glours left a comment

Choose a reason for hiding this comment

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

Can we keep the value of opts.ResolvePaths for the extendsOpts?
Its value can be set to false only from config command on Compose

// replace localResourceLoader with a new flavour, using extended file base path
extendsOpts.ResourceLoaders[len(opts.ResourceLoaders)-1] = localResourceLoader{
WorkingDir: localdir,
}
extendsOpts.ResolvePaths = true
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line is the root cause of the docker/compose#11377
It was introduced to remove potential import cycles 714c186

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ResolvePaths MUST be set so that ./env in a compose file that is used by extends: file=./foo/bar/compose.yaml is resolved as ./foo/bar/env and can be used as expected by the caller

Used by extend, PathResolution resolves relative paths from working directory, which is itself relative

Copy link
Collaborator

@glours glours left a comment

Choose a reason for hiding this comment

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

LGTM, I wasn't testing with the fixed version 🤦

@glours glours enabled auto-merge (rebase) January 22, 2024 10:29
@glours glours merged commit 0e8d665 into compose-spec:main Jan 22, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants