-
Opened from the agreed design on issue #2928. Adding the watchers of that issue here.
-
-
Name Previous Value Current Value Assignee
robin
cwh
-
-
Implemented automatic pre-allocation of host ports before workspace container start. The sourceable file
/onedev-workspace/port-mappings.envnow definesWORKSPACE_AGENT_HOSTand everyWORKSPACE_PORT_<containerPort>, and the Port Mappings UI reuses those exact mappings. Verified withmvn -Pce -pl server-plugin/server-plugin-provisioner-serverdocker -am -DskipTests compile(BUILD SUCCESS).Submitted as pr OD-104.
| Type |
Improvement
|
| Priority |
Normal
|
| Assignee | |
| Labels |
No labels
|
Issue Votes (0)
Summary
Expose OneDev workspace port-mapping information inside the workspace so tools that require an allowlist of external origins (e.g.
--allowed-origins=http://HOST:PORT) can be started with the same host/port used by Port Mappings links.Agreed design from issue #2928.
Motivation
Workspace containers publish ports via Docker (
docker -Ptoday). The Port Mappings UI shows host → published port (e.g.9832 → 55012), but nothing inside the workspace currently exposes that mapped host port (or the Port Mappings host) in a form a startup script can consume before launching tools.Agreed design
sourcethe file immediately.Variables in that file
WORKSPACE_AGENT_HOSTWORKSPACE_PORT_<containerPort>WORKSPACE_PORT_9832=55012; include all exposed ports)Example
Constraints / notes
-Passignment host ports are only known at start time — so pure-Pcannot provide a file that exists before the entrypoint runs.-P) satisfies “available at startup” without requiring users to manage port clashes.HOSTNAMEis not a reliable Port Mappings host; always exposeWORKSPACE_AGENT_HOSTexplicitly.Acceptance criteria
WORKSPACE_AGENT_HOSTandWORKSPACE_PORT_<containerPort>for all exposed ports.sourcethe file and launch tools with origins matching browser access URLs.Context
Original discussion and use case: issue #2928.