feat: Add devcontainer and vscode config#611
Open
nbmaiti wants to merge 2 commits into
Open
Conversation
nbmaiti
commented
Jun 15, 2026
cd0efa5 to
c1369d2
Compare
Author
|
Tested on corporate proxy and non-proxied environment |
Added devcontainter support for all builds, debug support
Signed-off-by: Nabendu Maiti <nabendu.bikash.maiti@intel.com>
c70d2e6 to
cbdfe3e
Compare
| @@ -0,0 +1,170 @@ | |||
| #!/bin/bash | |||
|
|
|||
| # This script runs on the host machine BEFORE the container is created. | |||
Comment on lines
+47
to
+54
| # Allow override via env; fall back to hostname -I (Linux) then localhost for cross-platform support | ||
| if [ -n "${MPS_COMMON_NAME:-}" ]; then | ||
| DEFAULT_MPS_COMMON_NAME="$MPS_COMMON_NAME" | ||
| elif command -v hostname >/dev/null 2>&1 && hostname -I >/dev/null 2>&1; then | ||
| DEFAULT_MPS_COMMON_NAME=$(hostname -I | awk '{print $1}') | ||
| else | ||
| DEFAULT_MPS_COMMON_NAME="host.docker.internal" | ||
| fi |
Comment on lines
+17
to
+26
| validate_repository() { | ||
| if [ -f "$README_FILE" ] && grep -q "Device Management Toolkit (formerly known as Open AMT Cloud Toolkit)" "$README_FILE"; then | ||
| REPO_TYPE="DMT" | ||
| echo "✓ Detected: Device Management Toolkit repository" | ||
| return 0 | ||
| fi | ||
|
|
||
| echo "✗ Error: Unrecognized repository. This script must be run from the Device Management Toolkit repository." | ||
| exit 1 | ||
| } |
Comment on lines
+117
to
+120
| VSCode->>Host: initializeCommand → pre-create.sh | ||
| Host->>Host: Validate repo (Readme.md check) | ||
| Host->>Host: Generate JWT_SECRET / JWT_ISSUER / VAULT_TOKEN | ||
| Host->>Host: Write .env, patch kong.yaml / cypress.config.ts / docker-compose.yml |
| | `.devcontainer/devcontainer.json` | Container definition, features, port forwarding, extension list | | ||
| | `.devcontainer/Dockerfile` | Ubuntu 22.04 + proxy env + sudoers `env_keep` | | ||
| | `.devcontainer/devcontainer-lock.json` | Pinned feature digests for reproducible builds | | ||
| | `.devcontainer/pre-create.sh` | **Host** hook: validates repo, generates secrets, writes `.env`, patches `kong.yaml` / `cypress.config.ts` / `docker-compose.yml` | |
Comment on lines
+5
to
+8
| for var in HTTP_PROXY HTTPS_PROXY NO_PROXY http_proxy https_proxy no_proxy; do | ||
| eval v="\${$var}" | ||
| if [ -z "$v" ]; then unset $var; fi | ||
| done |
Comment on lines
+11
to
+17
| strip_trailing_slash() { | ||
| local url="$1" | ||
| # Remove all trailing / or \ | ||
| url="${url%%*(/|\\)}" | ||
| # Fallback for Bash < 4.0 (no extglob): use sed | ||
| echo "$url" | sed 's%[\\/]*$%%' | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.