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

loader: restore implicit default of . for build context #423

Merged

Conversation

milas
Copy link
Member

@milas milas commented Jun 28, 2023

In the Compose spec, as well as Compose v1.x, the build.context field is mandatory in the object form of a service.build definition.

However, in compose-go (and thus Compose v2.x), this has never been enforced, and an empty build.context field was implicitly set to . aka the project directory.

Restore that behavior pending a decision on whether we want to make the spec less restrictive here so that this is acceptable or change compose-go to begin emitting a warning and eventually reject this.

Note that the order of normalization and resolving paths has been switched so that normalization occurs first, and then paths can be resolved across all fields consistently. This resulted in a small test update where this was incorrect before - it was loading with path resolution enabled but then asserting it had a relative path for the env file.

https://docker.atlassian.net/browse/ENV-239

In the Compose spec, as well as Compose v1.x, the `build.context`
field is mandatory in the object form of a `service.build` definition.

However, in compose-go (and thus Compose v2.x), this has never been
enforced, and an empty `build.context` field was implicitly set to
`.` aka the project directory.

Restore that behavior pending a decision on whether we want to make
the spec less restrictive here so that this is acceptable or change
`compose-go` to begin emitting a warning and eventually reject this.

Note that the order of normalization and resolving paths has been
switched so that normalization occurs first, and then paths can be
resolved across all fields consistently. This resulted in a small
test update where this was incorrect before - it was loading with
path resolution enabled but then asserting it had a relative path
for the env file.

Signed-off-by: Milas Bowman <[email protected]>
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

@laurazard laurazard merged commit 736df56 into compose-spec:master Jun 29, 2023
@milas milas deleted the restore-default-context-behavior branch June 29, 2023 20:03
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.

4 participants