Fix WriteEnvFile calls containing shell variables to use WriteProfileD#1262
Merged
Fix WriteEnvFile calls containing shell variables to use WriteProfileD#1262
Conversation
WriteEnvFile writes a literal string to disk — shell variables like $PORT,
$TMPDIR, $DEPS_DIR, and $JAVA_OPTS are never expanded. Switch all affected
callers to WriteProfileD so variables are expanded at container startup.
Affected components:
- play.go: JAVA_OPTS contained $PORT and $TMPDIR
- dist_zip.go: JAVA_OPTS contained $TMPDIR
- spring_boot_cli.go: JAVA_OPTS and SERVER_PORT both referenced runtime vars;
also aligns error handling with SpringBootContainer (fatal instead of warning)
- luna_security_provider.go: ChrystokiConfigurationPath and LD_LIBRARY_PATH
both contained $DEPS_DIR; LD_LIBRARY_PATH now uses shell parameter expansion
(${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}) to preserve existing values at runtime
Tests updated to assert profile.d script content instead of env/ file paths.
kiril-keranov
approved these changes
May 4, 2026
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
Follows up on #1256 by fixing the remaining
WriteEnvFilecalls that write shell variables as literal strings.WriteEnvFilestores values verbatim on disk —$PORT,$TMPDIR,$DEPS_DIR, and$JAVA_OPTSare never expanded.WriteProfileDwrites a shell script sourced at container startup where variables are expanded correctly.Changes
containers/play.goJAVA_OPTS$PORT,$TMPDIRcontainers/dist_zip.goJAVA_OPTS$TMPDIRcontainers/spring_boot_cli.goJAVA_OPTS,SERVER_PORT$JAVA_OPTS,$PORTframeworks/luna_security_provider.goChrystokiConfigurationPath,LD_LIBRARY_PATH$DEPS_DIRAdditional fix in
spring_boot_cli.goAligns error handling with
SpringBootContainer: write failures are now fatal (return error) instead of silently logged as warnings. A staging environment whereWriteProfileDfails is broken regardless — failing loudly is more debuggable.luna_security_provider.go—LD_LIBRARY_PATHbehaviour changeThe old code read
LD_LIBRARY_PATHat staging time and baked the value into the env file. The new profile.d script uses${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}to append the existing value at runtime, which is the correct behaviour for a variable that may be set by other profile.d scripts.Testing
Updated unit tests assert that
profile.d/scripts are written with the correctexportstatements and variable references instead of checking the oldenv/file paths.