gurumitts / pylutron-caseta

Apache License 2.0
153 stars 98 forks source link

devcontainer build: file permissions error on updateContent.sh makes the devcontainer build fail #158

Closed dkulla01 closed 7 months ago

dkulla01 commented 7 months ago

I ran into an issue trying to build the devcontainer for this project. I looked through the build logs to try to figure out what was going on, and I saw a file permissions error:

Running the updateContentCommand from devcontainer.json...

[3955 ms] Start: Run in container: /bin/sh -c ./.devcontainer/updateContent.sh
/bin/sh: 1: ./.devcontainer/updateContent.sh: Permission denied
[4087 ms] updateContentCommand failed with exit code 126. Skipping any further user-provided commands.
[4090 ms] Error: Command failed: /bin/sh -c ./.devcontainer/updateContent.sh
[4090 ms]     at fY (/Users/dan/.vscode/extensions/ms-vscode-remote.remote-containers-0.330.0/dist/spec-node/devContainersSpecCLI.js:235:130)
[4090 ms]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[4090 ms]     at async rl (/Users/dan/.vscode/extensions/ms-vscode-remote.remote-containers-0.330.0/dist/spec-node/devContainersSpecCLI.js:227:4393)
[4090 ms]     at async el (/Users/dan/.vscode/extensions/ms-vscode-remote.remote-containers-0.330.0/dist/spec-node/devContainersSpecCLI.js:227:3738)
[4090 ms]     at async il (/Users/dan/.vscode/extensions/ms-vscode-remote.remote-containers-0.330.0/dist/spec-node/devContainersSpecCLI.js:227:2814)
[4090 ms]     at async TeA (/Users/dan/.vscode/extensions/ms-vscode-remote.remote-containers-0.330.0/dist/spec-node/devContainersSpecCLI.js:614:30432)
[4090 ms]     at async PeA (/Users/dan/.vscode/extensions/ms-vscode-remote.remote-containers-0.330.0/dist/spec-node/devContainersSpecCLI.js:614:27664)
[4096 ms] Exit code 1
[4098 ms] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) --ms-enable-electron-run-as-node /Users/dan/.vscode/extensions/ms-vscode-remote.remote-containers-0.330.0/dist/spec-node/devContainersSpecCLI.js run-user-commands --user-data-folder /Users/dan/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --container-session-data-folder /tmp/devcontainers-bbe85333-bda9-45bc-88cf-5799b11724251706652672583 --workspace-folder /Users/dan/src/pylutron-caseta --id-label devcontainer.local_folder=/Users/dan/src/pylutron-caseta --id-label devcontainer.config_file=/Users/dan/src/pylutron-caseta/.devcontainer/devcontainer.json --container-id cc4dfea2292da7427c2e33f6afea8453e055af32948ebe5f0d67f419448a95d3 --log-level debug --log-format json --config /Users/dan/src/pylutron-caseta/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --skip-non-blocking-commands true --prebuild false --stop-for-personalization true --remote-env REMOTE_CONTAINERS_IPC=/tmp/vscode-remote-containers-ipc-cb728637-4a4d-4283-8931-67dbb39e6b69.sock --remote-env SSH_AUTH_SOCK=/tmp/vscode-ssh-auth-cb728637-4a4d-4283-8931-67dbb39e6b69.sock --remote-env REMOTE_CONTAINERS=true --mount-workspace-git-root --dotfiles-target-path ~/dotfiles
[4099 ms] Exit code 1

I'm not totally sure how the different components of this devcontainer build are set up, but for a quick test, I changed the file permissions on updateContent.sh with chmod 755 .devcontainer/updateContent.sh and tried rebuilding the devcontainer. With the updated file permissions on updateContent.sh, the devcontainer build succeeded.

I saw that this commit from a few days ago includes changes to devcontainer.json to include an updateContentCommand entry that points to the new updateContent.sh script, so I wonder if these changes are responsible for the failing devcontainer builds.

I think that either the file permissions for updateContent.sh need to change to make the file executable, or this line needs to be changed from

"updateContentCommand": "./.devcontainer/updateContent.sh"

to

"updateContentCommand": "bash ./.devcontainer/updateContent.sh"