-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(webapp): add RUNTIME_API_ORIGIN to decouple runner traffic from external origin #3686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
da151f6
27d4a8f
8f68050
5d57e9a
49c1cfd
43f8e77
75964b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| area: webapp | ||
| type: feature | ||
| --- | ||
|
|
||
| Add `RUNTIME_API_ORIGIN` env var to route managed runner traffic through an in-cluster URL, bypassing tracing gateways that rewrite the W3C `traceparent` header and break parent→child run links. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -980,6 +980,13 @@ function renameVariables(variables: EnvironmentVariable[], renameMap: Record<str | |
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Resolves trigger-side built-in environment variables that are merged into a | ||
| * task run's env but can be overridden by user-defined variables on the | ||
| * environment. Values come from server-level `env` and are surfaced to runners | ||
| * so they can pick up rollouts (e.g. the realtime stream version) without a | ||
| * redeploy. | ||
| */ | ||
| async function resolveOverridableTriggerVariables( | ||
| runtimeEnvironment: RuntimeEnvironmentForEnvRepo | ||
| ) { | ||
|
|
@@ -993,6 +1000,14 @@ async function resolveOverridableTriggerVariables( | |
| return result; | ||
| } | ||
|
|
||
| /** | ||
| * Resolves built-in environment variables that are injected into dev (CLI) task | ||
| * runs. Dev CLI typically runs on a developer's machine outside any cluster, | ||
| * so the runner-bypass `RUNTIME_API_ORIGIN` (which usually points at an | ||
| * in-cluster service URL) is intentionally NOT applied here -- using it would | ||
| * make the URL unreachable for the dev CLI. Dev keeps the original | ||
| * `API_ORIGIN`/`STREAM_ORIGIN`/`APP_ORIGIN` chain. | ||
| */ | ||
| async function resolveBuiltInDevVariables(runtimeEnvironment: RuntimeEnvironmentForEnvRepo) { | ||
| let result: Array<EnvironmentVariable> = [ | ||
| { | ||
|
|
@@ -1119,6 +1134,12 @@ async function resolveBuiltInDevVariables(runtimeEnvironment: RuntimeEnvironment | |
| return [...result, ...commonVariables]; | ||
| } | ||
|
|
||
| /** | ||
| * Resolves the OpenTelemetry collector endpoint advertised to dev (CLI) task | ||
| * runs. Defaults to the webapp's own `/otel` route under `APP_ORIGIN` so a | ||
| * vanilla self-host works without extra wiring; `DEV_OTEL_EXPORTER_OTLP_ENDPOINT` | ||
| * can override it to point spans/logs at an external collector. | ||
| */ | ||
| async function resolveOverridableOtelDevVariables( | ||
| runtimeEnvironment: RuntimeEnvironmentForEnvRepo | ||
| ) { | ||
|
|
@@ -1132,6 +1153,15 @@ async function resolveOverridableOtelDevVariables( | |
| return result; | ||
| } | ||
|
|
||
| /** | ||
| * Resolves built-in environment variables that are injected into managed | ||
| * (deployed) task runs. `TRIGGER_API_URL` and `TRIGGER_STREAM_URL` prefer | ||
| * `RUNTIME_API_ORIGIN` over `API_ORIGIN`/`STREAM_ORIGIN` so self-hosted | ||
| * deployments can keep runner-to-webapp traffic on a cluster-internal hop | ||
| * (bypassing tracing-enabled gateways that rewrite the W3C `traceparent` | ||
| * header on egress) without affecting the public origins exposed to external | ||
| * clients. | ||
| */ | ||
| async function resolveBuiltInProdVariables( | ||
| runtimeEnvironment: RuntimeEnvironmentForEnvRepo, | ||
| parentEnvironment?: RuntimeEnvironmentForEnvRepo | ||
|
|
@@ -1143,11 +1173,11 @@ async function resolveBuiltInProdVariables( | |
| }, | ||
| { | ||
| key: "TRIGGER_API_URL", | ||
| value: env.API_ORIGIN ?? env.APP_ORIGIN, | ||
| value: env.RUNTIME_API_ORIGIN ?? env.API_ORIGIN ?? env.APP_ORIGIN, | ||
| }, | ||
| { | ||
| key: "TRIGGER_STREAM_URL", | ||
| value: env.STREAM_ORIGIN ?? env.API_ORIGIN ?? env.APP_ORIGIN, | ||
| value: env.RUNTIME_API_ORIGIN ?? env.STREAM_ORIGIN ?? env.API_ORIGIN ?? env.APP_ORIGIN, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here |
||
| }, | ||
| { | ||
| key: "TRIGGER_RUNTIME_WAIT_THRESHOLD_IN_MS", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.