ci: Allocate example host ports dynamically instead of the static 1LLBN scheme

オープン
#1,516 コメント 0 件 リアクション 1 件 担当者 2 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@phlax がすでに取り組んでいます。

2026年10月12日 から。

  • #1517 @copilot-swe-agent による — マージされずにクローズ

評価

この issue はまだ評価されていません。

説明

enhancement

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:

  1. Before up: export PORT_<ROLE>=0 for every role the example's compose references.
  2. After up: resolve_ports — docker compose config --no-interpolate --format json to learn ${PORT_<ROLE>} → service:container_port, then docker compose port <service> <container_port> to get the actual host port, and re-export PORT_<ROLE>. Log each mapping so failures are debuggable.
  3. Existing http://localhost:${PORT_PROXY} steps work unchanged.
  4. Delete the export PORT_*= lines and the 1LLBN comment block from every verify.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 compose ports: host side must be exactly ${PORT_<ROLE>:-<default>}. A bare NNNN:MMMM cannot be made ephemeral and must fail. Covers all */docker-compose*.y*ml, including examples with no verify.sh.
  • Runtime backstop in bring_up_example: after up, docker compose ps --format json; any PublishedPort not produced by resolve_ports → fail. Catches extends, 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時間
マージ済み PR(30日)
31

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

envoyproxy/examples のほかの issue

envoyproxy/examples の issue をすべて見る

似ている issue

Shell/Bash の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。