Skip to content

Commit 6a69ed6

Browse files
committed
run engine v1 will only lock to v1 deployments
1 parent 1d920d5 commit 6a69ed6

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

apps/webapp/app/v3/models/workerDeployment.server.ts

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff 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

94137
export async function getCurrentWorkerDeploymentEngineVersion(

0 commit comments

Comments
 (0)