fix(init): make devcontainer postCreateCommand robust on Podman-on-Windows (#742)#744
Open
kaspergff wants to merge 1 commit into
Open
fix(init): make devcontainer postCreateCommand robust on Podman-on-Windows (#742)#744kaspergff wants to merge 1 commit into
kaspergff wants to merge 1 commit into
Conversation
…ndows The devcontainer template generated by `mxcli init`/`new` had two bugs that failed `postCreateCommand` (red error in VS Code) when the workspace is a 9p bind-mount from a Windows drive under Podman: 1. `file` was never installed in the image, so `file ./mxcli | grep -q Linux` emitted `command not found` and the Linux-binary fast-path was never taken (always re-downloaded). Add `file` to the Dockerfile apt list. 2. The download fallback ran an unguarded `chmod +x ./mxcli`, which fails with `Operation not permitted` on 9p (Unix perm changes disallowed) and failed the whole postCreate even though the binary is already executable. Guard it with `2>/dev/null || true`. Fixes mendixlabs#742 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Fixes two independent bugs in the devcontainer template generated by
mxcli init/mxcli new(cmd/mxcli/tool_templates.go). Both fail the container'spostCreateCommand(red error in VS Code) when the workspace is a 9p bind-mount from a Windows drive under Podman — even though the container itself builds andmxcliruns fine.Closes #742.
Bug 1 —
filenot installedpostCreateCommandgates the "keep the committed Linux binary" fast-path onfile ./mxcli | grep -q Linux, butfilewas never in the Dockerfile apt list →command not found: file→ fast-path never taken, always re-downloads.Fix: add
fileto the Dockerfile apt install list.Bug 2 — unguarded
chmodThe download fallback ended in
... && chmod +x ./mxcli. On 9p, Unix permission changes areOperation not permitted; the binary is already-rwxrwxrwx, but the non-zero exit failed the entirepostCreateCommand.Fix:
chmod +x ./mxcli 2>/dev/null || true.Environment reproduced
Windows 11 + WSL2 + Podman 5.8.2, Mendix project on
C:\Mendix\..., workspace via 9p, base imagemcr.microsoft.com/devcontainers/base:bookworm, mxcli v0.14.0.Validation
make build✅make test✅ (no new failures)make lint— Go lint ✅ (TSlint-tsstep needsbun, not installed in this env; unrelated)mxcli init --container-runtime podmanin a scratch dir → generateddevcontainer.jsonparses as valid JSON,postCreateCommandends with the guarded{ chmod +x ./mxcli 2>/dev/null || true; }, Dockerfile apt list containsfile, and the extractedpostCreateCommandpassesbash -n.Notes
cmd/mxcli/tool_templates.goholds this template. The repo's own.devcontainer/*uses a different (simpler)postCreateCommandand is unaffected.postCreateCommandstring, so nothing else changed.🤖 Generated with Claude Code