Skip to content

Commit fc4ede4

Browse files
authored
Merge branch 'main' into docs/product-image-generator
2 parents ce81f1f + 0f9b83d commit fc4ede4

File tree

24 files changed

+746
-365
lines changed

24 files changed

+746
-365
lines changed

.changeset/angry-files-yawn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Improves our schema to JSON Schema conversion, fixes zod 4 and a few other schema libraries, also correctly sets the dependencies

.changeset/seven-taxis-glow.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"trigger.dev": patch
3+
"@trigger.dev/core": patch
4+
---
5+
6+
Attach to existing deployment for deployments triggered in the build server. If `TRIGGER_EXISTING_DEPLOYMENT_ID` env var is set, the `deploy` command now skips the deployment initialization.

CHANGESETS.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ Please follow the best-practice of adding changesets in the same commit as the c
3030

3131
## Snapshot instructions
3232

33-
1. Delete the `.changeset/pre.json` file (if it exists)
33+
1. Update the `.changeset/config.json` file to set the `"changelog"` field to this:
3434

35-
2. Do a temporary commit (do NOT push this, you should undo it after)
35+
```json
36+
"changelog": "@changesets/cli/changelog",
37+
```
3638

37-
3. Copy the `GITHUB_TOKEN` line from the .env file
39+
2. Do a temporary commit (do NOT push this, you should undo it after)
3840

39-
4. Run `GITHUB_TOKEN=github_pat_12345 ./scripts/publish-prerelease.sh re2`
41+
3. Run `./scripts/publish-prerelease.sh prerelease`
4042

41-
Make sure to replace the token with yours. `re2` is the tag that will be used for the pre-release.
43+
You can choose a different tag if you want, but usually `prerelease` is fine.
4244

43-
5. Undo the commit where you deleted the pre.json file.
45+
5. Undo the commit where you updated the config.json file.

apps/supervisor/src/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const Env = z.object({
8989
KUBERNETES_CPU_REQUEST_RATIO: z.coerce.number().min(0).max(1).default(0.75), // Ratio of CPU limit, so 0.75 = 75% of CPU limit
9090
KUBERNETES_MEMORY_REQUEST_MIN_GB: z.coerce.number().min(0).default(0),
9191
KUBERNETES_MEMORY_REQUEST_RATIO: z.coerce.number().min(0).max(1).default(1), // Ratio of memory limit, so 1 = 100% of memory limit
92+
KUBERNETES_MEMORY_OVERHEAD_GB: z.coerce.number().min(0).optional(), // Optional memory overhead to add to the limit in GB
9293

9394
// Placement tags settings
9495
PLACEMENT_TAGS_ENABLED: BoolEnv.default(false),

apps/supervisor/src/workloadManager/kubernetes.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export class KubernetesWorkloadManager implements WorkloadManager {
2525
private readonly cpuRequestRatio = env.KUBERNETES_CPU_REQUEST_RATIO;
2626
private readonly memoryRequestMinGb = env.KUBERNETES_MEMORY_REQUEST_MIN_GB;
2727
private readonly memoryRequestRatio = env.KUBERNETES_MEMORY_REQUEST_RATIO;
28+
private readonly memoryOverheadGb = env.KUBERNETES_MEMORY_OVERHEAD_GB;
2829

2930
constructor(private opts: WorkloadManagerOptions) {
3031
this.k8s = createK8sApi();
@@ -319,9 +320,13 @@ export class KubernetesWorkloadManager implements WorkloadManager {
319320
}
320321

321322
#getResourceLimitsForMachine(preset: MachinePreset): ResourceQuantities {
323+
const memoryLimit = this.memoryOverheadGb
324+
? preset.memory + this.memoryOverheadGb
325+
: preset.memory;
326+
322327
return {
323328
cpu: `${preset.cpu}`,
324-
memory: `${preset.memory}G`,
329+
memory: `${memoryLimit}G`,
325330
};
326331
}
327332

apps/webapp/app/presenters/v3/DeploymentListPresenter.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class DeploymentListPresenter {
144144
wd."git"
145145
FROM
146146
${sqlDatabaseSchema}."WorkerDeployment" as wd
147-
INNER JOIN
147+
LEFT JOIN
148148
${sqlDatabaseSchema}."User" as u ON wd."triggeredById" = u."id"
149149
WHERE
150150
wd."projectId" = ${project.id}

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { LoaderFunctionArgs, json } from "@remix-run/server-runtime";
1+
import { type LoaderFunctionArgs, json } from "@remix-run/server-runtime";
2+
import { type GetDeploymentResponseBody } from "@trigger.dev/core/v3";
23
import { z } from "zod";
34
import { prisma } from "~/db.server";
45
import { authenticateApiRequest } from "~/services/apiAuth.server";
@@ -52,7 +53,10 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
5253
shortCode: deployment.shortCode,
5354
version: deployment.version,
5455
imageReference: deployment.imageReference,
55-
errorData: deployment.errorData,
56+
imagePlatform: deployment.imagePlatform,
57+
externalBuildData:
58+
deployment.externalBuildData as GetDeploymentResponseBody["externalBuildData"],
59+
errorData: deployment.errorData as GetDeploymentResponseBody["errorData"],
5660
worker: deployment.worker
5761
? {
5862
id: deployment.worker.friendlyId,
@@ -65,5 +69,5 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
6569
})),
6670
}
6771
: undefined,
68-
});
72+
} satisfies GetDeploymentResponseBody);
6973
}

apps/webapp/app/routes/resources.taskruns.$runParam.replay.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
108108
const disableVersionSelection = environment.type === "DEVELOPMENT";
109109
const allowArbitraryQueues = backgroundWorkers.at(0)?.engine === "V1";
110110

111+
const payload = await prettyPrintPacket(run.payload, run.payloadType);
112+
111113
return typedjson({
112114
concurrencyKey: run.concurrencyKey,
113115
maxAttempts: run.maxAttempts,
@@ -116,7 +118,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
116118
ttlSeconds: run.ttl ? parseDuration(run.ttl, "s") ?? undefined : undefined,
117119
idempotencyKey: run.idempotencyKey,
118120
runTags: run.runTags,
119-
payload: await prettyPrintPacket(run.payload, run.payloadType),
121+
payload,
120122
payloadType: run.payloadType,
121123
queue: run.queue,
122124
metadata: run.seedMetadata

apps/webapp/test/fairDequeuingStrategy.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ describe("FairDequeuingStrategy", () => {
270270

271271
console.log("Second distribution took", distribute2Duration, "ms");
272272

273-
// Make sure the second call is more than 2 times faster than the first
274-
expect(distribute2Duration).toBeLessThan(withTolerance(distribute1Duration / 2));
273+
// Make sure the second call is faster than the first
274+
expect(distribute2Duration).toBeLessThan(distribute1Duration);
275275

276276
const startDistribute3 = performance.now();
277277

@@ -284,8 +284,8 @@ describe("FairDequeuingStrategy", () => {
284284

285285
console.log("Third distribution took", distribute3Duration, "ms");
286286

287-
// Make sure the third call is more than 4 times the second
288-
expect(withTolerance(distribute3Duration)).toBeGreaterThan(distribute2Duration * 4);
287+
// Make sure the third call is faster than the second
288+
expect(withTolerance(distribute3Duration)).toBeGreaterThan(distribute2Duration);
289289
}
290290
);
291291

docs/troubleshooting.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ This can happen in different situations, for example when using plain strings as
183183

184184
### Task run stalled executing
185185

186-
If you see a `TASK_RUN_STALLED_EXECUTING` error it means that we didn't receive a heartbeat from your task before the stall timeout. We automatically heartbeat runs every 30 seconds, and the heartbeat timeout is 10 minutes.
186+
If you see a `TASK_RUN_STALLED_EXECUTING` error it means that we didn't receive a heartbeat from your task before the stall timeout. We automatically heartbeat runs every 30 seconds, and the heartbeat timeout is 5 minutes.
187187

188188
<Note>
189189

0 commit comments

Comments
 (0)