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 COMPOSE_PROJECT_NAME interpolation #1165

Merged
merged 4 commits into from
Mar 20, 2025

Conversation

r10r
Copy link
Contributor

@r10r r10r commented Mar 12, 2025

This fixes the interpolation of the environment variable COMPOSE_PROJECT_NAME
when it is generated from the top-levelname value within the compose.yaml.

See #1073 and the integration test description for details.

This PR was developed independently from #805 (because I did not look for related open PRs first) but addresses the same issue and contains the required integration test. I think #805 can be closed if this PR is merged.

@r10r r10r changed the title Fix COMPOSE_PROJECT_NAME interpolation Fix COMPOSE_PROJECT_NAME interpolation Mar 12, 2025
@r10r r10r force-pushed the fix-project-name-interpolation branch from 198623d to 6fd5b54 Compare March 12, 2025 16:03
@r10r r10r changed the title Fix COMPOSE_PROJECT_NAME interpolation WIP: Fix COMPOSE_PROJECT_NAME interpolation Mar 12, 2025
@r10r
Copy link
Contributor Author

r10r commented Mar 12, 2025

After looking at #805 I noticed that apart from the interpolation the evaluation order is wrong.
The compose spec defines the evaluation order here https://docs.docker.com/compose/how-tos/project-name/#set-a-project-name

I'll add a separate commit that addresses this issue including another integration test.

@r10r r10r changed the title WIP: Fix COMPOSE_PROJECT_NAME interpolation Fix COMPOSE_PROJECT_NAME interpolation Mar 12, 2025
@p12tic
Copy link
Collaborator

p12tic commented Mar 19, 2025

@r10r Thanks for the PR, code changes look good.

Please add a release note to the newsfragments directory (you can look here for inspiration on how release note looks like). In this PR I think there are not one but two fixes.

@r10r
Copy link
Contributor Author

r10r commented Mar 19, 2025

@r10r Thanks for the PR, code changes look good.

Please add a release note to the newsfragments directory (you can look here for inspiration on how release note looks like). In this PR I think there are not one but two fixes.

Thanks for the review. I'll add the release note as soon as possible.

r10r added 4 commits March 20, 2025 12:07
The COMPOSE_PROJECT_NAME environment variable must override the
top-level name: attribute in the Compose file.

The precedence order is defined in the docker compose documentation
https://docs.docker.com/compose/how-tos/project-name/#set-a-project-name

Signed-off-by: Ruben Jenster <[email protected]>
@r10r r10r force-pushed the fix-project-name-interpolation branch from c8f4107 to 65b455f Compare March 20, 2025 11:10
@r10r
Copy link
Contributor Author

r10r commented Mar 20, 2025

@p12tic I've added the release notes and moved the section formatted by ruff to the corresponding commit.

@p12tic p12tic merged commit 7d75337 into containers:main Mar 20, 2025
8 checks passed
@p12tic
Copy link
Collaborator

p12tic commented Mar 20, 2025

Thank you very much

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