Commit b2cdc64
committed
fix: inject environment variables at dequeue time for self-hosted deployments
This commit fixes the issue where environment variables configured in the
Trigger.dev portal were not being injected into runner pods/containers in
self-hosted deployments (GitHub issue #2792).
Root Cause:
Environment variables were only being fetched during the 'startRunAttempt'
phase, which occurs AFTER the runner pod/container has already been created.
This meant that pods were created without access to portal-configured
environment variables, causing tasks to fail immediately.
Solution:
Move environment variable fetching from the 'startRunAttempt' phase to the
'dequeue' phase, so that env vars are available when the supervisor creates
the runner workload.
Changes:
1. Added optional 'envVars' field to DequeuedMessage schema
2. Modified AuthenticatedWorkerInstance.dequeue() to fetch and include
environment variables for each dequeued message
3. Added 'envVars' field to WorkloadManagerCreateOptions interface
4. Updated supervisor to pass envVars when creating workloads
5. Modified KubernetesWorkloadManager to inject envVars into pod spec
6. Modified DockerWorkloadManager to inject envVars into container
Testing:
- Tested in self-hosted Kubernetes deployment (EKS)
- Verified environment variables appear in runner pods
- Confirmed tasks execute successfully with portal-configured env vars
Fixes #27921 parent ff80742 commit b2cdc64
File tree
6 files changed
+48
-1
lines changed- apps
- supervisor/src
- workloadManager
- webapp/app/v3/services/worker
- packages/core/src/v3/schemas
6 files changed
+48
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
270 | 271 | | |
271 | 272 | | |
272 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
228 | 234 | | |
229 | 235 | | |
230 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
373 | | - | |
| 373 | + | |
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
379 | 411 | | |
380 | 412 | | |
381 | 413 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
273 | 274 | | |
274 | 275 | | |
0 commit comments