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(jsonnet): Restore tk.env #482

Merged
merged 2 commits into from
Jan 21, 2021
Merged

fix(jsonnet): Restore tk.env #482

merged 2 commits into from
Jan 21, 2021

Conversation

sh0rez
Copy link
Member

@sh0rez sh0rez commented Jan 20, 2021

In a recent refactor (#459) we lost tk.env respectivley
std.extVar("tanka.dev/environment") support.

For static environment this however is still the way to go for accessing
env data from within Jsonnet.

This PR restores the functionality and also makes Tanka properly fail
with a message when attempting to use tk.env from an inline environment

Fixes #480

In a recent refactor we lost `tk.env` respectivley
`std.extVar("tanka.dev/environment")` support.

For static environment this however is still the way to go for accessing
env data from within Jsonnet.

This PR restores the functionality and also makes Tanka properly fail
with a message when attempting to use `tk.env` from an inline environment
@sh0rez sh0rez added kind/bug Something isn't working component/jsonnet Everything regarding the jsonnet language labels Jan 20, 2021
@sh0rez sh0rez requested a review from Duologic January 20, 2021 12:12
Because jsonnet.Opts includes a `map[string]string`, it is not
concurrency-safe, as all goroutines effectively share the same extCode
and tlaCode.

Modifications of any routine is also reflected onto every other routine.

To temporarily combat that, this PR deep-clones jsonnet.Opts before
passing it to any goroutine.

This is not a good permanent solution, because it can be easily
forgotten. We should instead look into ways of fixing the jsonnet
package so that such race conditions don't occur at all
@sh0rez sh0rez merged commit 2caa673 into master Jan 21, 2021
@sh0rez sh0rez deleted the fix-tkenvextvar branch January 21, 2021 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/jsonnet Everything regarding the jsonnet language kind/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undefined external variable: tanka.dev/environment
3 participants