This directory contains code that is shared across multiple features.
scripts/
├── lib/
│ └── common-setup.sh # Source of truth for user selection helper
└── sync-common-setup.sh # Script to deploy helper to all features
scripts/lib/common-setup.sh is the single source of truth for the user selection helper function. All modifications should be made to this file.
Due to the devcontainer CLI's packaging behavior (each feature is packaged independently), the helper must be present in each feature's directory at packaging time. This is handled automatically by CI — all workflows run scripts/sync-common-setup.sh after checkout and before packaging.
The copies are .gitignored — only the source file is tracked in git.
- Edit: Make changes to
scripts/lib/common-setup.sh - Test: Run
bash test/_global/test-common-setup.shto verify - Commit: Only the source file needs to be committed
The devcontainer CLI packages each feature independently:
- Parent directories are not included in the build context
- Hidden directories (
.common) are not included - Sibling directories are not accessible
Therefore, each feature needs its own copy of the helper to ensure it's available at runtime during feature installation.
Tests are located in test/_global/ and source from the canonical scripts/lib/common-setup.sh:
bash test/_global/test-common-setup.shTo generate the copies locally (e.g., for testing features outside CI):
./scripts/sync-common-setup.shThis approach is a workaround for the current limitation. The devcontainer spec has a proposal for an include property in devcontainer-feature.json that would allow native code sharing (see devcontainers/spec#129). Once implemented, this sync mechanism can be removed.