Caching home directory for remoteUser after feature install
~Adds coalescing logic following how commons-utils feature handles home directories for users that do not have one from source image~. [Updated]
Caching container user home directory and remote user home directory after any feature installs, this will increase build time in a matter of milliseconds but will ensure that after each feature layer, the _CONTAINER_USER_HOME and _REMOTE_USER_HOME will be updated and cached for the next feature to be installed.
This should solve issue #331 .
Open to suggestions on how to improve, adding same coalesce for _CONTAINER_USER_HOME does not break anything, but didn't want to include that until told otherwise by maintainers.
Locally tested as follows:
- using a devcontainer.json as follows
{
"name": "test",
"image": "ubuntu:jammy",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"username": "vscode",
"installZsh": true,
"installOhMyZsh": true,
"upgradePackages": true
},
"ghcr.io/stuartleeks/dev-container-features/shell-history:0": {}
},
"remoteUser": "vscode"
}
- compiled with yarn
- built the test devcontainer with
node devcontainer.js build --config test/devcontainer.json --workspace-folder . - started the test devcontainer with
node devcontainer.js up --config test/devcontainer.json --workspace-folder . - enter the running devcontiner with
docker exec -it <CONTAINER_NAME> sh - verified
shell-historyfeature installed correctly for the newly created user
Tested with host:
- windows with wsl, intel chipset
- osx sonoma, m1 chipset
- codespace with repository devcontainer.json configuration
Tests need to be updated (see test failures). It would also be great to have a test specifically for this where a first feature creates a user and a second feature then checks if the env variables are updated correctly.