ci: Allocate example host ports dynamically instead of the static 1LLBN scheme
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
Supersedes the original proposal on this issue (static 1LLBN lint). After discussion, the static scheme solves the problem the hard way: the kernel already has a collision-free port allocator, and compose can use it via host port 0.
Goal
When Bazel runs every verify.sh in parallel on one Docker host, no two examples can ever publish the same host port — with no human-maintained allocation table and no per-example export PORT_*=<literal> lines.
How
Compose files already use "${PORT_PROXY:-10000}:10000"; the :-10000 stays as the user default for docs. In CI, verify-common.sh sets every PORT_* to 0 before up, Docker binds ephemeral host ports, and we read them back before any test step runs:
- Before
up:export PORT_<ROLE>=0for every role the example's compose references. - After
up:resolve_ports—docker compose config --no-interpolate --format jsonto learn${PORT_<ROLE>}→service:container_port, thendocker compose port <service> <container_port>to get the actual host port, and re-exportPORT_<ROLE>. Log each mapping so failures are debuggable. - Existing
http://localhost:${PORT_PROXY}steps work unchanged. - Delete the
export PORT_*=lines and the1LLBNcomment block from everyverify.sh/verify-common.sh.
Pre-up case
Where a port is interpolated into something other than ports: (a frontend config telling the browser where the backend is), 0 can't work because the value is needed before up. Known: cors, csrf, single-page-app. For these, pre-reserve: bind a socket on port 0, read it, close it, export it, then up. Small race; acceptable. Ideally the same resolve_ports code path handles both by detecting whether a role is referenced outside ports:.
Guardrails (keep — these are what actually guarantee nothing is exposed undeconflicted)
- Bazel lint (
yq→jq): every composeports:host side must be exactly${PORT_<ROLE>:-<default>}. A bareNNNN:MMMMcannot be made ephemeral and must fail. Covers all*/docker-compose*.y*ml, including examples with noverify.sh. - Runtime backstop in
bring_up_example: afterup,docker compose ps --format json; anyPublishedPortnot produced byresolve_ports→ fail. Catchesextends, override files,network_mode: host.
Validation
Prove it before committing: branch that flips verify-common.sh and runs the full verify_examples.sh matrix. Expect everything to pass except the pre-up examples until pre-reservation is added. Also confirm docker compose port behaves with 0-published ports on the compose version CI uses.
Base
Start from #1513 (normalised PORT_* names, removed stray publications, ${PORT_*}-templated filter-cc/wasm-cc) — it's the right base even though its literal defaults will be deleted.
Out of scope
vrp-litmus/vrp-local— being removed.
- 主要语言
- Shell
- 星标
- 75
- 派生
- 39
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 31
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
envoyproxy/examples 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 68/100
envoyproxy/examples#1640 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
envoyproxy/examples#1629 · 7 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
envoyproxy/examples#1515 ·
维护者通常 1 天内回复
-
ai-transcoder sandbox: requirements for resubmission可能重新可做 @phlax 于 49 天前认领,目前没有进行中的 PR。 未关闭enhancement
envoyproxy/examples#1499 · 3 条评论 · 1 个 reaction · 已指派 2 人 ·
维护者通常 1 天内回复
-
Add a `dynamic-mod-rust` example (Rust dynamic module HTTP filter)可能重新可做 @phlax 于 65 天前认领,目前没有进行中的 PR。 未关闭enhancement
envoyproxy/examples#1440 · 1 个 reaction · 已指派 2 人 ·
维护者通常 1 天内回复
查看 envoyproxy/examples 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
github/gh-aw-firewall#12415 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 92/100
tldr-pages/tldr#25620 · 1 条评论 ·
维护者通常 1 天内回复
-
documentation
难度 2/5 1-3 小时 新手友好度 82/100
-
source:reader type:content-error
难度 2/5 1-3 小时 新手友好度 76/100
stephrobert/blog-roadmap#251 ·