Repository navigation
fix(features): keep host variables raw in the metadata label - #69
Merged
Merged
Conversation
A Feature's mounts were resolved on the build host before the image's
devcontainer.metadata label was written, so the image carried that
host's paths (${localEnv:HOME} became /home/<user>) and resolved them
the same way on every other host. The metadata substitution also wrote
its result back through mounts and maps it shared with the label's
entries, so in compose it rewrote base-image mounts in the label too.
As the reference CLI does, the label now keeps each Feature's values as
the Feature declares them, and up resolves them on the host it runs
on, from a copy: for single-container and compose, where Feature
lifecycle commands with host variables used to run unresolved, and in
read-configuration's merged configuration, which printed them raw.
Only the Dockerfile ENV line for a Feature's containerEnv stays
resolved at build time (upstream #308).
Three runtime parity cases compare the label, the compose labels and
the merged configuration with the reference.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Aligns the
devcontainer.metadatalabel with the official CLI.Problem
${localEnv:HOME}became/home/<user>) and applied them on every other host.upnever resolved host variables in Feature lifecycle commands.read-configuration --include-merged-configurationprinted them raw, where TS resolves them.Now (Go = TS
getDevcontainerMetadata/pickFeatureProperties)build"source":"/home/aledbf""source":"${localEnv:HOME}"up: image and container labelsup)postCreateCommandwith${localEnv}read-configurationmergedConfigurationThe Dockerfile
ENVline for a Feature'scontainerEnvstays resolved at build time. That is the documented #308 fix: BuildKit rejects${localEnv:…}there.Tests (all fail on
main)TestExtendImageWithFeaturesResolvesFeatureHostVars, now scoped to the ENV line, plus the raw label mount.TestBuildAndExtendComposeKeepsFeatureHostVariablesRawInTheLabel.TestHostMetadataSubstitutionLeavesTheRawEntriesRaw: the write-through.TestSubstituteFeatureHostVarsandTestE2E_FeatureUserHomeAndLocalEnvadapted to the new contract.build.feature-host-variables-raw-label-success,up.compose-feature-host-variables-raw-label-success,read-configuration.feature-host-variables-merged-success.Validation (local)
task lint,task spec:compliance,task test:e2e(13 pass): pass.task test:racewithTMPDIRoutside/tmp: pass.task parity:contract: only the 2 known/tmp/.gitcases fail.buildand compose cases match. The newread-configurationcase differs locally only in theworkspaceblock, because of the/tmp/.giton this machine (same asmain); its mergedConfiguration matches TS. The other local failures are the same/tmp/.gitgroup, or Docker timeouts under parallel load that match when rerun alone.🤖 Generated with Claude Code