Skip to content

Commit 0036567

Browse files
Merge branch 'main' into TRI-4372
2 parents 7f67ffd + 1f1a6b0 commit 0036567

File tree

150 files changed

+3722
-1652
lines changed

Some content is hidden

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

150 files changed

+3722
-1652
lines changed

.changeset/funny-emus-pay.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/lazy-carpets-reply.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/lovely-toys-obey.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+
Auto-fix /trigger or /src/trigger config.dirs to relative paths to prevent misconfiguration from preventing dev CLI from working

.github/workflows/pr_checks.yml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,3 @@ jobs:
2828
with:
2929
package: cli-v3
3030
secrets: inherit
31-
32-
preview-release:
33-
name: Preview Release
34-
needs: [typecheck, units, e2e]
35-
if: github.repository == 'triggerdotdev/trigger.dev'
36-
runs-on: ubuntu-latest
37-
steps:
38-
- name: ⬇️ Checkout repo
39-
uses: actions/checkout@v4
40-
with:
41-
fetch-depth: 0
42-
43-
- name: ⎔ Setup pnpm
44-
uses: pnpm/action-setup@v4
45-
with:
46-
version: 8.15.5
47-
48-
- name: ⎔ Setup node
49-
uses: buildjet/setup-node@v4
50-
with:
51-
node-version: 20.11.1
52-
cache: "pnpm"
53-
54-
- name: 📥 Download deps
55-
run: pnpm install --frozen-lockfile
56-
57-
- name: 🏗️ Build
58-
run: pnpm run build --filter "@trigger.dev/*" --filter "trigger.dev"
59-
60-
- name: ⚡ Publish preview release
61-
run: npx pkg-pr-new publish --no-template $(ls -d ./packages/*)

.vscode/launch.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
"cwd": "${workspaceFolder}/references/init-shell",
4747
"sourceMaps": true
4848
},
49+
{
50+
"type": "node-terminal",
51+
"request": "launch",
52+
"name": "Debug V3 init dev CLI",
53+
"command": "pnpm exec trigger dev",
54+
"cwd": "${workspaceFolder}/references/init-shell",
55+
"sourceMaps": true
56+
},
4957
{
5058
"type": "node-terminal",
5159
"request": "launch",

apps/kubernetes-provider/src/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ const UPTIME_MAX_PENDING_ERRORS = Number(process.env.UPTIME_MAX_PENDING_ERRORS |
3737
const POD_EPHEMERAL_STORAGE_SIZE_LIMIT = process.env.POD_EPHEMERAL_STORAGE_SIZE_LIMIT || "10Gi";
3838
const POD_EPHEMERAL_STORAGE_SIZE_REQUEST = process.env.POD_EPHEMERAL_STORAGE_SIZE_REQUEST || "2Gi";
3939

40+
const PRE_PULL_DISABLED = process.env.PRE_PULL_DISABLED === "true";
41+
4042
const logger = new SimpleLogger(`[${NODE_NAME}]`);
4143
logger.log(`running in ${RUNTIME_ENV} mode`);
4244

@@ -301,6 +303,11 @@ class KubernetesTaskOperations implements TaskOperations {
301303
}
302304

303305
async prePullDeployment(opts: TaskOperationsPrePullDeploymentOptions) {
306+
if (PRE_PULL_DISABLED) {
307+
logger.debug("Pre-pull is disabled, skipping.", { opts });
308+
return;
309+
}
310+
304311
const metaName = this.#getPrePullContainerName(opts.shortCode);
305312

306313
const metaLabels = {
@@ -332,6 +339,22 @@ class KubernetesTaskOperations implements TaskOperations {
332339
spec: {
333340
...this.#defaultPodSpec,
334341
restartPolicy: "Always",
342+
affinity: {
343+
nodeAffinity: {
344+
requiredDuringSchedulingIgnoredDuringExecution: {
345+
nodeSelectorTerms: [
346+
{
347+
matchExpressions: [
348+
{
349+
key: "trigger.dev/pre-pull-disabled",
350+
operator: "DoesNotExist",
351+
},
352+
],
353+
},
354+
],
355+
},
356+
},
357+
},
335358
initContainers: [
336359
{
337360
name: "prepull",

apps/webapp/app/components/navigation/SideMenu.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
ChartBarIcon,
77
ClockIcon,
88
CreditCardIcon,
9-
CursorArrowRaysIcon,
109
IdentificationIcon,
1110
KeyIcon,
1211
RectangleStackIcon,
@@ -38,7 +37,6 @@ import {
3837
organizationTeamPath,
3938
personalAccessTokensPath,
4039
projectEnvironmentsPath,
41-
projectEventsPath,
4240
projectHttpEndpointsPath,
4341
projectPath,
4442
projectRunsPath,
@@ -451,12 +449,6 @@ function V2ProjectSideMenu({
451449
to={projectTriggersPath(organization, project)}
452450
data-action="triggers"
453451
/>
454-
<SideMenuItem
455-
name="Events"
456-
icon={CursorArrowRaysIcon}
457-
activeIconColor="text-sky-500"
458-
to={projectEventsPath(organization, project)}
459-
/>
460452
<SideMenuItem
461453
name="HTTP endpoints"
462454
icon="http-endpoint"

apps/webapp/app/components/runs/v3/RunFilters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ function TasksDropdown({
444444
<SelectList>
445445
{filtered.map((item, index) => (
446446
<SelectItem
447-
key={item.slug}
447+
key={`${item.triggerSource}-${item.slug}`}
448448
value={item.slug}
449449
icon={
450450
<TaskTriggerSourceIcon source={item.triggerSource} className="size-4 flex-none" />

apps/webapp/app/db.server.ts

Lines changed: 69 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import { logger } from "./services/logger.server";
1313
import { isValidDatabaseUrl } from "./utils/db";
1414
import { singleton } from "./utils/singleton";
1515
import { $transaction as transac } from "@trigger.dev/database";
16+
import { startActiveSpan } from "./v3/tracer.server";
17+
import { Span } from "@opentelemetry/api";
1618

1719
export type {
1820
PrismaTransactionClient,
@@ -21,25 +23,76 @@ export type {
2123
PrismaReplicaClient,
2224
};
2325

26+
export async function $transaction<R>(
27+
prisma: PrismaClientOrTransaction,
28+
name: string,
29+
fn: (prisma: PrismaTransactionClient, span?: Span) => Promise<R>,
30+
options?: PrismaTransactionOptions
31+
): Promise<R | undefined>;
2432
export async function $transaction<R>(
2533
prisma: PrismaClientOrTransaction,
2634
fn: (prisma: PrismaTransactionClient) => Promise<R>,
2735
options?: PrismaTransactionOptions
36+
): Promise<R | undefined>;
37+
export async function $transaction<R>(
38+
prisma: PrismaClientOrTransaction,
39+
fnOrName: ((prisma: PrismaTransactionClient) => Promise<R>) | string,
40+
fnOrOptions?: ((prisma: PrismaTransactionClient) => Promise<R>) | PrismaTransactionOptions,
41+
options?: PrismaTransactionOptions
2842
): Promise<R | undefined> {
29-
return transac(
30-
prisma,
31-
fn,
32-
(error) => {
33-
logger.error("prisma.$transaction error", {
34-
code: error.code,
35-
meta: error.meta,
36-
stack: error.stack,
37-
message: error.message,
38-
name: error.name,
39-
});
40-
},
41-
options
42-
);
43+
if (typeof fnOrName === "string") {
44+
return await startActiveSpan(fnOrName, async (span) => {
45+
span.setAttribute("$transaction", true);
46+
47+
if (options?.isolationLevel) {
48+
span.setAttribute("isolation_level", options.isolationLevel);
49+
}
50+
51+
if (options?.timeout) {
52+
span.setAttribute("timeout", options.timeout);
53+
}
54+
55+
if (options?.maxWait) {
56+
span.setAttribute("max_wait", options.maxWait);
57+
}
58+
59+
if (options?.swallowPrismaErrors) {
60+
span.setAttribute("swallow_prisma_errors", options.swallowPrismaErrors);
61+
}
62+
63+
const fn = fnOrOptions as (prisma: PrismaTransactionClient, span: Span) => Promise<R>;
64+
65+
return transac(
66+
prisma,
67+
(client) => fn(client, span),
68+
(error) => {
69+
logger.error("prisma.$transaction error", {
70+
code: error.code,
71+
meta: error.meta,
72+
stack: error.stack,
73+
message: error.message,
74+
name: error.name,
75+
});
76+
},
77+
options
78+
);
79+
});
80+
} else {
81+
return transac(
82+
prisma,
83+
fnOrName,
84+
(error) => {
85+
logger.error("prisma.$transaction error", {
86+
code: error.code,
87+
meta: error.meta,
88+
stack: error.stack,
89+
message: error.message,
90+
name: error.name,
91+
});
92+
},
93+
typeof fnOrOptions === "function" ? undefined : fnOrOptions
94+
);
95+
}
4396
}
4497

4598
export { Prisma };
@@ -58,6 +111,7 @@ function getClient() {
58111
const databaseUrl = extendQueryParams(DATABASE_URL, {
59112
connection_limit: env.DATABASE_CONNECTION_LIMIT.toString(),
60113
pool_timeout: env.DATABASE_POOL_TIMEOUT.toString(),
114+
connection_timeout: env.DATABASE_CONNECTION_TIMEOUT.toString(),
61115
});
62116

63117
console.log(`🔌 setting up prisma client to ${redactUrlSecrets(databaseUrl)}`);
@@ -109,6 +163,7 @@ function getReplicaClient() {
109163
const replicaUrl = extendQueryParams(env.DATABASE_READ_REPLICA_URL, {
110164
connection_limit: env.DATABASE_CONNECTION_LIMIT.toString(),
111165
pool_timeout: env.DATABASE_POOL_TIMEOUT.toString(),
166+
connection_timeout: env.DATABASE_CONNECTION_TIMEOUT.toString(),
112167
});
113168

114169
console.log(`🔌 setting up read replica connection to ${redactUrlSecrets(replicaUrl)}`);

0 commit comments

Comments
 (0)