@@ -99,6 +99,10 @@ export class InitializeDeploymentService extends BaseService {
9999
100100 const { imageRef, isEcr, repoCreated } = imageRefResult ;
101101
102+ // we keep using `BUILDING` as the initial status if not explicitly set
103+ // to avoid changing the behavior for deployments not created in the build server
104+ const initialStatus = payload . initialStatus ?? "BUILDING" ;
105+
102106 logger . debug ( "Creating deployment" , {
103107 environmentId : environment . id ,
104108 projectId : environment . projectId ,
@@ -108,6 +112,7 @@ export class InitializeDeploymentService extends BaseService {
108112 imageRef,
109113 isEcr,
110114 repoCreated,
115+ initialStatus,
111116 } ) ;
112117
113118 const deployment = await this . _prisma . workerDeployment . create ( {
@@ -116,7 +121,7 @@ export class InitializeDeploymentService extends BaseService {
116121 contentHash : payload . contentHash ,
117122 shortCode : deploymentShortCode ,
118123 version : nextVersion ,
119- status : "BUILDING" ,
124+ status : initialStatus ,
120125 environmentId : environment . id ,
121126 projectId : environment . projectId ,
122127 externalBuildData,
@@ -131,7 +136,7 @@ export class InitializeDeploymentService extends BaseService {
131136
132137 await TimeoutDeploymentService . enqueue (
133138 deployment . id ,
134- "BUILDING" ,
139+ deployment . status ,
135140 "Building timed out" ,
136141 new Date ( Date . now ( ) + env . DEPLOY_TIMEOUT_MS )
137142 ) ;
0 commit comments