-
Notifications
You must be signed in to change notification settings - Fork 27
Devcontainer improvements #1137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- include adapter name in the devcontainer name to be able to distinguish between different opened vscode instances - use forwardPorts to make it accessible in the vscode tab "ports" - use portsAttributes to give the port a name - update the position of settings and extensions due to schema update - put the postcreate commands into a separate script - allow to extend the post create script with custom script to i.e. configure the adapter with a test configuration automatically - make the iobroker (non-root) user the default user to not get permission problems because files created or modified (also .git/ files) will be owned by root and working outside the devcontainer is a problem then postcreate.sh - create and stop a new instance of the adapter in questions to avoid the manual task - execute a custom script (postcreate_ext.sh) if the user provided one, so this file can stay as is docker-compose.yml - remove obsolete version attribute - remove persisting the iobroker data to a volume - this will defeat the purpose of "rebuild container" because the volume still stays the same. This causes side effects. A dev container is build and created once, and recreated from scrach if needed. All configuration which is needed for a test must be done in the post create extension script. That way the devcontainer is robust and is always created correctly. - use non-default ports for the main redis instance, to be able to call integration tests which also start a redis instance on default ports. - remove the static port mapping to 8082 as it prevents to be able to open devcontainers of two different adapters at the same time. instead rely on the feature of vscode to dynamically assign a available host port.
change postcreate from chaining commands to set -e simplify custom script execution avoid the need for execution permissions
call npm install on post create
- move node_modules to / so also non-root is able to use this global node_modules dir - add node wrapper due capability/non-root/debug issue in nodejs which is a open bug - rewrite the entrypoint to be able to forward the log into the devcontainer log boot.sh - use boot.sh to tee the log of the entrypoint into a log file which can be tail'd in the poststart/postcreate node-wrapper.sh - add a node wrapper to support non-root debugging even with cap_net_raw capability devcontainer.json - upper case B in ioBroker - add a poststart script to also show the boot log when the container was created already postcreate.sh - add some echos - add wait for script to avoid race conditions - find adapter name automatically poststart.sh - show boot.log also during container start wait_for_iobroker.sh - make sure we don't run into a race condition with the entrypoint which runs in the background
- fix path to custom postcreate
update style flavor fix typos
- fix indendation
Some adapters already using this configuration successfully: https://github.com/hacki11/ioBroker.valloxmv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces comprehensive improvements to the Dev Container setup for ioBroker adapter development, focusing on robustness, reliability, and usability. The changes enable simultaneous adapter development, add a robust setup process, support non-root users, and provide a debugging-ready environment out of the box.
Key changes include:
- Dev Container enhancements for multi-adapter development with dynamic naming and port forwarding
- Admin dependency version constraint updated from fixed to greater-or-equal (
>=
) for better compatibility - Comprehensive file structure additions for new devcontainer baseline test case
Reviewed Changes
Copilot reviewed 92 out of 97 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
test/create-adapter.test.ts | Adds new test case for devcontainer functionality and updates file filter logic |
test/baselines/ioBroker.hello-devcontainer/* | Complete baseline files for new devcontainer test case including Docker configs, scripts, and adapter structure |
test/baselines/devcontainer/* | Updated devcontainer baseline files with improved configuration |
test/baselines/*/io-package.json | Updates admin dependency from fixed version to >=7.0.23 |
templates/* | New template files for devcontainer scripts, launch configuration, and updated existing templates |
docs/updates/* | Migration documentation for the changes |
CHANGELOG.md | Documents the new features and migration guides |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
PR Checklist:
npm run build
npm test
.github/create_templates.ts
)docs/updates
explaining what the user needs to do when manually updating an existing projectCHANGELOG.md
(referencing the migration description and this PR or the issue you fixed)Description:
Dev Container Improvements
This pull request brings the improvements and relevant changes to the Dev Container setup for ioBroker adapter development, focusing on robustness, reliability and usability. Key updates include:
More:
Dev Container Improvements
Allow newer versions of
admin
How to test:
Select
Reopen in Container
in VS Code.This PR also includes #1135
fixes #1128