devcontainers-contrib / features

🐳 Extra add-in features for Devcontainers and GitHub Codespaces
MIT License
224 stars 116 forks source link

Optional install of mixins #437

Closed ross-p-smith closed 1 year ago

ross-p-smith commented 1 year ago

Porter mixin/plugin installation should be optional. If an empty string is submitted in the version field of each mixin, it will not install.

I also found that curl was not installed when running the tests locally.

When testing for the mixins or plugins, you can call the "version" command on each to test if it is installed.

ross-p-smith commented 1 year ago

Fixes #436

ross-p-smith commented 1 year ago

Latest update on this.

According to the build of the devcontainer, it carries out a chown correctly with the vscode user

[2023-05-22T19:51:10.140Z] #17 17.58 cd /tmp/tmplt0rze8t && chmod +x -R . && _REMOTE_USER="vscode" _REMOTE_USER_HOME="/home/vscode" COMMAND="chown -R ${_REMOTE_USER}:${_REMOTE_USER} /usr/local/porter" NANOLAYER_VERBOSE="" NANOLAYER_FORCE_CLI_INSTALLATION="" NANOLAYER_PROPAGATE_CLI_LOCATION="1" NANOLAYER_CLI_LOCATION="/tmp/nanolayer-N1PlftsajE/nanolayer" bash  -i  +H ./install.sh
#17 17.58 + rm -rf '/var/lib/apt/lists/*'
#17 17.58 + bash -c 'chown -R vscode:vscode /usr/local/porter'
#17 17.58 + rm -rf '/var/lib/apt/lists/*'
#17 17.58 + echo 'Done!'
#17 17.58 Done!
#17 17.63 Done!

However, when it runs the devcontainer features test, the vscode user is no longer user 1000, but is now UID 1001 !?!? It is as though vscode the user has been deleted and recreated.

User: vscode
User: 1001
Group: 123
Remote User: 
total 61848
drwxr-xr-x 4 1000 1000     4096 May 22 19:51 .
drwxr-xr-x 1 root root     4096 May 22 19:51 ..
drwxr-x--- 4 1000 1000     4096 May 22 19:51 mixins
-rwxr-xr-x 1 1000 1000 63314226 May 22 19:51 porter
drwxr-xr-x 2 1000 1000     4096 May 22 19:51 runtimes
could not list the contents of the mixins directory "/usr/local/porter/mixins": open /usr/local/porter/mixins: permission denied
ross-p-smith commented 1 year ago

@danielbraun89 - I have amended the scenarios.json to explicitly use UID 1000 which gets around the issue that only occurs in GitHub builds. I have tested this locally and with a cloned build. Would you be able to retrigger a build again?

danielbraun89 commented 1 year ago

@ross-p-smith I had this exact problem a week ago on another feature, kept getting permission denied to a directory and the user is the same vscode, I thought I was going crazy! I was somehow lucky to notice too the user name was the same but user id changed to 1001 from 1000 🤦 Eventually I turned to group-id-based permission which remained the same, but I see your user id at senarios.json as more straightforward solution - I am now contemplating whether it will be beneficial to add it to all scenario files of all features, to be on the safe side, and also because explicit is always better than implicit