crunchloop / crunchloop/devcontainer

compose: RenderEntrypointWrapper doesn't gate entrypoint/command on overrideCommand

Đang mở
#104 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
5
Fork
0
Merge trung bình
6 giờ 17 phút
Pull request đã merge (30 ngày)
15

Mô tả

## Summary

`compose.RenderEntrypointWrapper` (added in #103) is a faithful port of the reference `devcontainers/cli` `generateFeaturesComposeOverrideContent`, with one deliberate gap: it does **not** implement `overrideCommand` gating of the original entrypoint/command.

## Reference behavior

In `src/spec-node/dockerCompose.ts` the CLI computes:

```ts
const userEntrypoint = overrideCommand ? [] : composeEntrypoint || (imageEntrypoint…);
const userCommand = overrideCommand ? [] : composeCommand || (imageCmd…);
// …emits `command: ` only when userCommand !== composeCommand
```

When `overrideCommand` is **true**, both the original entrypoint and command are zeroed — the generated wrapper runs the feature entrypoints, then `exec "$@"` hits empty args and falls through to the `while sleep 1 & wait $!; do :; done` keep-alive.

## Our behavior

`RenderEntrypointWrapper` always preserves the original entrypoint (service's `entrypoint:`, else the image `ENTRYPOINT`) and never zeroes the command or emits a `command:` override. We do not read `cfg.OverrideCommand` on the compose path at all (`serviceToRunSpec` also ignores it).

## Why this is low priority

Per the dev container spec, `overrideCommand` defaults to **false for Docker Compose** (true only for image/Dockerfile). With it false, the reference takes the `composeEntrypoint || …` / `composeCommand || …` branches — i.e. preserves exactly what we preserve. So for the default compose case (and the DAP devcontainer this was built for), our output is behaviorally equivalent to upstream.

The only divergence is an explicit `"overrideCommand": true` on a **compose** devcontainer: upstream would drop the service command and rely on the wrapper's keep-alive; we keep the command.

## Options

- Implement `overrideCommand` gating in the compose path for full parity (zero entrypoint/command + emit keep-alive command when `overrideCommand` is true), or
- Leave as-is and document the limitation.

## Related

- PR #103 (compose feature security metadata + entrypoint chaining)
- Separate follow-up: image-source (non-compose) entrypoint chaining is also not yet implemented (`newRunSpec` doesn't consume `cfg.Entrypoints`).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by locating compose.RenderEntrypointWrapper and serviceToRunSpec, then compare their behavior with src/spec-node/dockerCompose.ts and the newRunSpec path. Verify how cfg.OverrideCommand is represented and test the explicit compose overrideCommand=true case. Done means either matching upstream by zeroing the entrypoint and command with the keep-alive behavior, or documenting the limitation if that option is chosen.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
docker, docker-compose, go
Lĩnh vực
devops, infrastructure
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.