-
Notifications
You must be signed in to change notification settings - Fork 7
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
Validation false positive for nested interpolation in docker-compose #252
Comments
Interesting, because this uses the docker-compose spec library to validate. There could be something missed though. Can you provide how you're defining this (full docker-compose file would be nice if possible) |
x-environment: &default-environment
MYVAR1: ${MYVAR1:-${MYVAR2:-defaultvalue}substring}
services:
cli:
image: uselagoon/php-8.1-cli-drupal:23.10.0
environment:
<<: *default-environment |
I only was able to find this
Not sure how to follow to the library though. The official docker compose docs state that nested interpolation is supported Looking at the tests here, https://github.com/uselagoon/build-deploy-tool/tree/6bd767a68605db8e16a553d0f61766969852d3ca/test-resources/docker-compose, there is not a single instance of nested interpolation of variables among those fixtures. |
We use the We don't have a test case for nested interpolation because until today you're the first person to do it. When I run your provided nested variable into a test case, I get the following
but if I do it like the docker docs state and use |
For some reason, maybe there is a fix in a newer compose-go library version, it doesn't like the I'll check the compose-go library if there is a fix in a newer version, otherwise will have to log an issue with them. |
What is the version of the compose-go are you using? https://github.com/compose-spec/compose-go/pull/405/files |
Yes, just saw that. I'll see if we can update our version. We are running a forked version at the moment due to some Lagoon-isms though that I'll need to backport. |
Will see what I can do, but it may not be today. |
The use case is quite wide: base a value on Example from DrevOps:
I want the default URL to be based on |
@tobybellwood |
oh - ahahaha - I realised that i'd pinned my docker compose v2 to v2.17.3 for testing last week... And hence why it was broken on my local (and hence was hitting the exact same bug) |
a gentle bump on this one. consumer projects need to use workarounds that would need to be undone later. I'm happy to sponsor this work. |
Edit: TLDR; we are addressing it, but unfortunately we have to tackle it over some time to gently nudge people. There is a linked issue where we are looking to incorporate the changes required to do this, but there are issues that we face with changing the library to a newer version. See the linked PR #253 for the change to upgrade the library. PR #255 was created to take care the other issue, we can't implement the changes for #253 as they would immediately fail almost every single build in AIO cloud Lagoon, and probably anyone that has used our old examples. We use #255 to warn people now in their builds to say that they have things that they need to address before we can incorporate the changes in #253. |
@shreddedbacon |
No ETA. As mentioned in the last comment there are a lot of other considerations here before we can use the newer version of the compose spec. We can't just fail every build, we have gradually been rolling out warnings in the builds for things that the upgrade of the compose spec would cause failures for. We are working on it, but as this is the only report of the bug, it isn't as high on the list as slowly informing people that we are about to break their builds is. |
This just took a new twist: there is now a support for defining several
Doing so, does not pass the validator:
So this is a second case where we really need the support for a new Docker Compose will keep updating the format and this new format would need to be supported at some point anyway. Can this be prioritised? |
Yes, we are aware of all of these. Unfortunately as said before, the tradeoff with moving to the latest version is that people will get build failures for things that we would no longer be able to check for. We need to make a call on our end as to when we will do that. |
This PR is work on getting it done, you can see that support for env_file is there #304 |
When provisioning in Lagoon, the following variable assignment in the
docker-compose.yml
is reported as invalid, while Docker Compose considers this valid and can process it accordingly.When provisioning in Lagoon, the following error is received:
Please note that any modern shell supports nested variable interpolation, so supporting this in Lagoon seems a reasonable expectation.
The text was updated successfully, but these errors were encountered: