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 deployed to each feature's _lib/ directory. We maintain this through a sync script:
./scripts/sync-common-setup.shThis copies scripts/lib/common-setup.sh to all features:
src/anaconda/_lib/common-setup.shsrc/docker-in-docker/_lib/common-setup.sh- etc.
- Edit: Make changes to
scripts/lib/common-setup.sh - Test: Run
bash test/_lib/test-common-setup.shto verify - Sync: Run
./scripts/sync-common-setup.shto deploy to all features - Commit: Commit both the source and all copies together
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/_lib/ and reference the anaconda feature's copy as the source:
bash test/_lib/test-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.