Skip to content

Commit c1306eb

Browse files
committed
Merge remote-tracking branch 'origin/run-engine-2' into run-engine-batch-trigger
2 parents 64c4a99 + 14250d5 commit c1306eb

File tree

54 files changed

+325
-769
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+325
-769
lines changed

.github/workflows/e2e.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
- name: 📥 Download deps
3939
run: pnpm install --frozen-lockfile --filter trigger.dev...
4040

41+
- name: 📀 Generate Prisma Client
42+
run: pnpm run generate
43+
4144
- name: 🔧 Build v3 cli monorepo dependencies
4245
run: pnpm run build --filter trigger.dev^...
4346

.github/workflows/pr_checks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ jobs:
5454
- name: 📥 Download deps
5555
run: pnpm install --frozen-lockfile
5656

57+
- name: 📀 Generate Prisma Client
58+
run: pnpm run generate
59+
5760
- name: 🏗️ Build
5861
run: pnpm run build --filter "@trigger.dev/*" --filter "trigger.dev"
5962

.github/workflows/unit-tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ jobs:
2424
node-version: 20.11.1
2525
cache: "pnpm"
2626

27+
# ..to avoid rate limits when pulling images
28+
- name: 🐳 Login to DockerHub
29+
uses: docker/login-action@v3
30+
with:
31+
username: ${{ secrets.DOCKERHUB_USERNAME }}
32+
password: ${{ secrets.DOCKERHUB_TOKEN }}
33+
2734
- name: 📥 Download deps
2835
run: pnpm install --frozen-lockfile
2936

apps/coordinator/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@
2323
"tinyexec": "^0.3.0"
2424
},
2525
"devDependencies": {
26-
"@types/node": "^18",
2726
"dotenv": "^16.4.2",
2827
"esbuild": "^0.19.11",
29-
"tsx": "^4.7.0",
30-
"typescript": "^5.3.3"
28+
"tsx": "^4.7.0"
3129
}
3230
}

apps/coordinator/src/checkpointer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export class Checkpointer {
193193
const start = performance.now();
194194
this.#logger.log(`checkpointAndPush() start`, { start, opts });
195195

196-
let interval: NodeJS.Timer | undefined;
196+
let interval: NodeJS.Timeout | undefined;
197197

198198
if (opts.shouldHeartbeat) {
199199
interval = setInterval(() => {

apps/docker-provider/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
"execa": "^8.0.1"
2121
},
2222
"devDependencies": {
23-
"@types/node": "^18.19.8",
2423
"dotenv": "^16.4.2",
2524
"esbuild": "^0.19.11",
26-
"tsx": "^4.7.0",
27-
"typescript": "^5.3.3"
25+
"tsx": "^4.7.0"
2826
}
2927
}

apps/kubernetes-provider/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"devDependencies": {
2424
"dotenv": "^16.4.2",
2525
"esbuild": "^0.19.11",
26-
"tsx": "^4.7.0",
27-
"typescript": "^5.3.3"
26+
"tsx": "^4.7.0"
2827
}
2928
}

apps/proxy/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
},
1010
"devDependencies": {
1111
"@cloudflare/workers-types": "^4.20240512.0",
12-
"typescript": "^5.0.4",
1312
"wrangler": "^3.57.1"
1413
},
1514
"dependencies": {

apps/webapp/app/routes/api.v1.deployments.ts

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
import { env } from "~/env.server";
77
import { authenticateApiRequest } from "~/services/apiAuth.server";
88
import { logger } from "~/services/logger.server";
9+
import { ServiceValidationError } from "~/v3/services/baseService.server";
910
import { InitializeDeploymentService } from "~/v3/services/initializeDeployment.server";
1011

1112
export async function action({ request, params }: ActionFunctionArgs) {
@@ -33,18 +34,30 @@ export async function action({ request, params }: ActionFunctionArgs) {
3334

3435
const service = new InitializeDeploymentService();
3536

36-
const { deployment, imageTag } = await service.call(authenticatedEnv, body.data);
37-
38-
const responseBody: InitializeDeploymentResponseBody = {
39-
id: deployment.friendlyId,
40-
contentHash: deployment.contentHash,
41-
shortCode: deployment.shortCode,
42-
version: deployment.version,
43-
externalBuildData:
44-
deployment.externalBuildData as InitializeDeploymentResponseBody["externalBuildData"],
45-
imageTag,
46-
registryHost: body.data.registryHost ?? env.DEPLOY_REGISTRY_HOST,
47-
};
48-
49-
return json(responseBody, { status: 200 });
37+
try {
38+
const { deployment, imageTag } = await service.call(authenticatedEnv, body.data);
39+
40+
const responseBody: InitializeDeploymentResponseBody = {
41+
id: deployment.friendlyId,
42+
contentHash: deployment.contentHash,
43+
shortCode: deployment.shortCode,
44+
version: deployment.version,
45+
externalBuildData:
46+
deployment.externalBuildData as InitializeDeploymentResponseBody["externalBuildData"],
47+
imageTag,
48+
registryHost: body.data.registryHost ?? env.DEPLOY_REGISTRY_HOST,
49+
};
50+
51+
return json(responseBody, { status: 200 });
52+
} catch (error) {
53+
if (error instanceof ServiceValidationError) {
54+
return json({ error: error.message }, { status: 400 });
55+
} else if (error instanceof Error) {
56+
logger.error("Error initializing deployment", { error: error.message });
57+
return json({ error: `Internal server error: ${error.message}` }, { status: 500 });
58+
} else {
59+
logger.error("Error initializing deployment", { error: String(error) });
60+
return json({ error: "Internal server error" }, { status: 500 });
61+
}
62+
}
5063
}

apps/webapp/app/routes/api.v1.workers.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ export const loader = createLoaderApiRoute(
1515
corsStrategy: "all",
1616
findResource: async () => 1, // This is a dummy function, we don't need to find a resource
1717
},
18-
async ({ authentication }): Promise<TypedResponse<WorkersListResponseBody>> => {
18+
async ({
19+
authentication,
20+
}): Promise<TypedResponse<WorkersListResponseBody | { error: string }>> => {
21+
if (authentication.environment.project.engine !== "V2") {
22+
return json({ error: "Not supported for V1 projects" }, { status: 400 });
23+
}
24+
1925
const service = new WorkerGroupService();
2026
const workers = await service.listWorkerGroups({
2127
projectId: authentication.environment.projectId,
@@ -33,12 +39,19 @@ export const loader = createLoaderApiRoute(
3339
}
3440
);
3541

36-
export const action = createActionApiRoute(
42+
export const { action } = createActionApiRoute(
3743
{
3844
corsStrategy: "all",
3945
body: WorkersCreateRequestBody,
4046
},
41-
async ({ authentication, body }): Promise<TypedResponse<WorkersCreateResponseBody>> => {
47+
async ({
48+
authentication,
49+
body,
50+
}): Promise<TypedResponse<WorkersCreateResponseBody | { error: string }>> => {
51+
if (authentication.environment.project.engine !== "V2") {
52+
return json({ error: "Not supported" }, { status: 400 });
53+
}
54+
4255
const service = new WorkerGroupService();
4356
const { workerGroup, token } = await service.createWorkerGroup({
4457
projectId: authentication.environment.projectId,

0 commit comments

Comments
 (0)