File tree Expand file tree Collapse file tree
apps/webapp/app/v3/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ export async function findCurrentWorkerDeployment(
7171 id : true ,
7272 imageReference : true ,
7373 version : true ,
74+ type : true ,
7475 worker : {
7576 select : {
7677 id : true ,
@@ -88,7 +89,49 @@ export async function findCurrentWorkerDeployment(
8889 } ,
8990 } ) ;
9091
91- return promotion ?. deployment ;
92+ if ( ! promotion ) {
93+ return undefined ;
94+ }
95+
96+ if ( promotion . deployment . type === "V1" ) {
97+ // This is a run engine v1 deployment, so return it
98+ return promotion . deployment ;
99+ }
100+
101+ // We need to get the latest run engine v1 deployment
102+ const latestV1Deployment = await prisma . workerDeployment . findFirst ( {
103+ where : {
104+ environmentId,
105+ type : "V1" ,
106+ } ,
107+ orderBy : {
108+ id : "desc" ,
109+ } ,
110+ select : {
111+ id : true ,
112+ imageReference : true ,
113+ version : true ,
114+ type : true ,
115+ worker : {
116+ select : {
117+ id : true ,
118+ friendlyId : true ,
119+ version : true ,
120+ sdkVersion : true ,
121+ cliVersion : true ,
122+ supportsLazyAttempts : true ,
123+ tasks : true ,
124+ engine : true ,
125+ } ,
126+ } ,
127+ } ,
128+ } ) ;
129+
130+ if ( ! latestV1Deployment ) {
131+ return undefined ;
132+ }
133+
134+ return latestV1Deployment ;
92135}
93136
94137export async function getCurrentWorkerDeploymentEngineVersion (
You can’t perform that action at this time.
0 commit comments