Repository navigation
fix(config): keep a workspace's user_data script as written - #1780
Merged
Merged
Conversation
The daemon expanded ${VAR} references across the whole daemon.yaml text,
so the $VARS of a user_data script were replaced with the daemon's empty
environment and the computer ran a broken script at boot. Sidecar values
now expand after parsing, every value except user_data, and an unquoted
value still takes the type of what it expands to.
Contributor
|
🎉 This PR is included in version 0.251.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A kubernetes workspace's
user_datareached the pod with every shell variable blanked. The daemon ranos.ExpandEnvover the wholedaemon.yamltext before parsing it, so"$OPENTASK_DIR"in the script became""and the desktop's default user data failed at boot withinstall: '': chmod failed, putting the computer in a restart loop. There was no way to escape it either, asos.ExpandEnvturns$$XintoX.Sidecar files now expand
${VAR}references after parsing, value by value, and skipuser_data, whose$VARSbelong to the shell that runs it.Changes
cmd/runtime/config.go:readYAMLMapparses into ayaml.NodeandexpandEnvValuesexpands every scalar except auser_datavalue. An unquoted scalar takes the type of its expanded value, soport: ${PORT}is still a number, also through the fixups that re-marshal their file. An expanded value can no longer add YAML structure. An empty file still reads as nil.cmd/runtime/isolation_test.go:TestWorkspaceUserDataKeepsItsShellVariables(fails before this change) andTestExpandedUnquotedValueKeepsItsType.docs/daemon.md:user_datais the one value whose$VARreferences are never expanded.Follow-up to #1777.