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

[bug] score-compose causes double $$ escapes to break #148

Open
astromechza opened this issue Jun 4, 2024 · 2 comments
Open

[bug] score-compose causes double $$ escapes to break #148

astromechza opened this issue Jun 4, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@astromechza
Copy link
Member

astromechza commented Jun 4, 2024

When a variable contains $${foo} we current unescape it to ${foo} in the Dockerfile, which then causes the compose execution to break if the variable foo is not available, or if the format is bad like ${foo.bar.baz}.

This is generally not what we expect, and we'd rather users use an environment type resource if they need to access environment variables. Thus we want ${foo} to be escaped again, back to $${foo}, OR to add some other mechanism for resolving these.

A big usecase is for something like a workload that has $${pod.metadata.name} in an environment variable because the end goal is to deploy to Humanitec. Docker will never resolve ${pod.metadata.name}. And overrides are not useful here, because they must be applied to the whole usage of the variable, not the actual placeholder itself.

Solution 1: Do nothing, customers must find and replace the unsatisified placeholders before running compose up.

Solution 2: Replace $${foo.bar} with ${FOO_BAR} so that an environment variable can be used.

Solution 3: Don't unescape $${foo.bar} in variables, so that it just stays as ${foo.bar} at runtime.

Solution 4: Provide a --override-placeholder foo.bar=new-value option to supply a value to replace.

Solution 5. A mix of 3, and 4.

So far I think solution 5 is the answer: default to no escape, but allow override.

@astromechza astromechza added the bug Something isn't working label Jun 4, 2024
@astromechza astromechza self-assigned this Jun 4, 2024
@astromechza
Copy link
Member Author

This will need changes in github.com/score-spec/score-go.

@astromechza
Copy link
Member Author

I've cut score-spec/score-go#42 to improve this in score-go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant