File tree Expand file tree Collapse file tree 6 files changed +16
-12
lines changed
internal-packages/run-engine/src/engine/systems
packages/core/src/v3/schemas Expand file tree Collapse file tree 6 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,12 @@ class ManagedSupervisor {
244244 }
245245
246246 try {
247+ if ( ! message . deployment . friendlyId ) {
248+ // mostly a type guard, deployments always exists for deployed environments
249+ // a proper fix would be to use a discriminated union schema to differentiate between dequeued runs in dev and in deployed environments.
250+ throw new Error ( "Deployment is missing" ) ;
251+ }
252+
247253 await this . workloadManager . create ( {
248254 dequeuedAt : message . dequeuedAt ,
249255 envId : message . environment . id ,
@@ -252,8 +258,8 @@ class ManagedSupervisor {
252258 machine : message . run . machine ,
253259 orgId : message . organization . id ,
254260 projectId : message . project . id ,
255- deploymentId : message . deployment . friendlyId ,
256- deploymentVersion : message . deployment . version ,
261+ deploymentFriendlyId : message . deployment . friendlyId ,
262+ deploymentVersion : message . backgroundWorker . version ,
257263 runId : message . run . id ,
258264 runFriendlyId : message . run . friendlyId ,
259265 version : message . version ,
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ export class DockerWorkloadManager implements WorkloadManager {
7272 `TRIGGER_DEQUEUED_AT_MS=${ opts . dequeuedAt . getTime ( ) } ` ,
7373 `TRIGGER_POD_SCHEDULED_AT_MS=${ Date . now ( ) } ` ,
7474 `TRIGGER_ENV_ID=${ opts . envId } ` ,
75- `TRIGGER_DEPLOYMENT_ID=${ opts . deploymentId } ` ,
75+ `TRIGGER_DEPLOYMENT_ID=${ opts . deploymentFriendlyId } ` ,
7676 `TRIGGER_DEPLOYMENT_VERSION=${ opts . deploymentVersion } ` ,
7777 `TRIGGER_RUN_ID=${ opts . runFriendlyId } ` ,
7878 `TRIGGER_SNAPSHOT_ID=${ opts . snapshotFriendlyId } ` ,
Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ export class KubernetesWorkloadManager implements WorkloadManager {
125125 } ,
126126 {
127127 name : "TRIGGER_DEPLOYMENT_ID" ,
128- value : opts . deploymentId ,
128+ value : opts . deploymentFriendlyId ,
129129 } ,
130130 {
131131 name : "TRIGGER_DEPLOYMENT_VERSION" ,
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export interface WorkloadManagerCreateOptions {
2929 envType : EnvironmentType ;
3030 orgId : string ;
3131 projectId : string ;
32- deploymentId : string ;
32+ deploymentFriendlyId : string ;
3333 deploymentVersion : string ;
3434 runId : string ;
3535 runFriendlyId : string ;
Original file line number Diff line number Diff line change @@ -562,10 +562,9 @@ export class DequeueSystem {
562562 // TODO: use a discriminated union schema to differentiate between dequeued runs in dev and in deployed environments.
563563 // Would help make the typechecking stricter
564564 deployment : {
565- id : result . deployment ?. id ?? "NO_DEPLOYMENT_DEV_ENV" ,
566- friendlyId : result . deployment ?. friendlyId ?? "NO_DEPLOYMENT_DEV_ENV" ,
567- version : result . deployment ?. version ?? "NO_DEPLOYMENT_DEV_ENV" ,
568- imagePlatform : result . deployment ?. imagePlatform ?? "NO_DEPLOYMENT_DEV_ENV" ,
565+ id : result . deployment ?. id ,
566+ friendlyId : result . deployment ?. friendlyId ,
567+ imagePlatform : result . deployment ?. imagePlatform ,
569568 } ,
570569 run : {
571570 id : lockedTaskRun . id ,
Original file line number Diff line number Diff line change @@ -246,9 +246,8 @@ export const DequeuedMessage = z.object({
246246 version : z . string ( ) ,
247247 } ) ,
248248 deployment : z . object ( {
249- id : z . string ( ) ,
250- friendlyId : z . string ( ) ,
251- version : z . string ( ) ,
249+ id : z . string ( ) . optional ( ) ,
250+ friendlyId : z . string ( ) . optional ( ) ,
252251 imagePlatform : z . string ( ) . optional ( ) ,
253252 } ) ,
254253 run : z . object ( {
You can’t perform that action at this time.
0 commit comments