trigger.dev 4.1.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/apiClient.d.ts +15 -2
- package/dist/esm/apiClient.js +11 -1
- package/dist/esm/apiClient.js.map +1 -1
- package/dist/esm/build/buildWorker.d.ts +2 -0
- package/dist/esm/build/buildWorker.js +16 -1
- package/dist/esm/build/buildWorker.js.map +1 -1
- package/dist/esm/build/bundle.d.ts +7 -2
- package/dist/esm/build/bundle.js +17 -6
- package/dist/esm/build/bundle.js.map +1 -1
- package/dist/esm/build/extensions.d.ts +4 -2
- package/dist/esm/build/extensions.js +15 -13
- package/dist/esm/build/extensions.js.map +1 -1
- package/dist/esm/build/manifests.d.ts +1 -1
- package/dist/esm/build/manifests.js +74 -5
- package/dist/esm/build/manifests.js.map +1 -1
- package/dist/esm/cli/common.d.ts +2 -2
- package/dist/esm/cli/common.js +1 -0
- package/dist/esm/cli/common.js.map +1 -1
- package/dist/esm/commands/analyze.d.ts +2 -2
- package/dist/esm/commands/deploy.js +328 -26
- package/dist/esm/commands/deploy.js.map +1 -1
- package/dist/esm/commands/dev.d.ts +2 -2
- package/dist/esm/commands/dev.js +1 -1
- package/dist/esm/commands/dev.js.map +1 -1
- package/dist/esm/commands/env.js +3 -3
- package/dist/esm/commands/env.js.map +1 -1
- package/dist/esm/commands/init.js +1 -1
- package/dist/esm/commands/init.js.map +1 -1
- package/dist/esm/commands/install-mcp.d.ts +2 -2
- package/dist/esm/commands/list-profiles.d.ts +2 -2
- package/dist/esm/commands/login.d.ts +2 -2
- package/dist/esm/commands/login.js +1 -1
- package/dist/esm/commands/login.js.map +1 -1
- package/dist/esm/commands/logout.d.ts +2 -2
- package/dist/esm/commands/logout.js +1 -1
- package/dist/esm/commands/logout.js.map +1 -1
- package/dist/esm/commands/mcp.d.ts +2 -2
- package/dist/esm/commands/mcp.js +1 -1
- package/dist/esm/commands/mcp.js.map +1 -1
- package/dist/esm/commands/preview.js +1 -1
- package/dist/esm/commands/preview.js.map +1 -1
- package/dist/esm/commands/promote.js +1 -1
- package/dist/esm/commands/promote.js.map +1 -1
- package/dist/esm/commands/switch.d.ts +2 -2
- package/dist/esm/commands/trigger.d.ts +2 -2
- package/dist/esm/commands/trigger.js +1 -1
- package/dist/esm/commands/trigger.js.map +1 -1
- package/dist/esm/commands/update.d.ts +2 -2
- package/dist/esm/commands/whoami.d.ts +2 -2
- package/dist/esm/commands/whoami.js +1 -1
- package/dist/esm/commands/whoami.js.map +1 -1
- package/dist/esm/commands/workers/build.js +2 -1
- package/dist/esm/commands/workers/build.js.map +1 -1
- package/dist/esm/commands/workers/create.js +1 -1
- package/dist/esm/commands/workers/create.js.map +1 -1
- package/dist/esm/commands/workers/list.js +1 -1
- package/dist/esm/commands/workers/list.js.map +1 -1
- package/dist/esm/commands/workers/run.js +1 -1
- package/dist/esm/commands/workers/run.js.map +1 -1
- package/dist/esm/deploy/archiveContext.d.ts +2 -0
- package/dist/esm/deploy/archiveContext.js +130 -0
- package/dist/esm/deploy/archiveContext.js.map +1 -0
- package/dist/esm/deploy/buildImage.js +4 -2
- package/dist/esm/deploy/buildImage.js.map +1 -1
- package/dist/esm/dev/devSession.js +6 -9
- package/dist/esm/dev/devSession.js.map +1 -1
- package/dist/esm/dev/devSupervisor.js +2 -46
- package/dist/esm/dev/devSupervisor.js.map +1 -1
- package/dist/esm/entryPoints/dev-run-worker.js +1 -0
- package/dist/esm/entryPoints/dev-run-worker.js.map +1 -1
- package/dist/esm/entryPoints/managed-run-worker.js +1 -0
- package/dist/esm/entryPoints/managed-run-worker.js.map +1 -1
- package/dist/esm/executions/taskRunProcess.js +4 -0
- package/dist/esm/executions/taskRunProcess.js.map +1 -1
- package/dist/esm/utilities/dotEnv.js +11 -1
- package/dist/esm/utilities/dotEnv.js.map +1 -1
- package/dist/esm/utilities/fileSystem.d.ts +17 -0
- package/dist/esm/utilities/fileSystem.js +63 -0
- package/dist/esm/utilities/fileSystem.js.map +1 -1
- package/dist/esm/utilities/initialBanner.d.ts +2 -2
- package/dist/esm/utilities/initialBanner.js +6 -6
- package/dist/esm/utilities/initialBanner.js.map +1 -1
- package/dist/esm/utilities/logger.d.ts +1 -1
- package/dist/esm/utilities/tempDirectories.d.ts +7 -0
- package/dist/esm/utilities/tempDirectories.js +23 -0
- package/dist/esm/utilities/tempDirectories.js.map +1 -1
- package/dist/esm/utilities/windows.d.ts +3 -1
- package/dist/esm/utilities/windows.js +14 -1
- package/dist/esm/utilities/windows.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +7 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/cli/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAClF,aAAa,EAAE,CAA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11 +8,11 @@ declare const AnalyzeOptions: z.ZodObject<Pick<{
|
|
|
8
8
|
}, "logLevel" | "skipTelemetry"> & {
|
|
9
9
|
verbose: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
logLevel: "error" | "
|
|
11
|
+
logLevel: "error" | "log" | "debug" | "info" | "warn" | "none";
|
|
12
12
|
verbose: boolean;
|
|
13
13
|
skipTelemetry: boolean;
|
|
14
14
|
}, {
|
|
15
|
-
logLevel?: "error" | "
|
|
15
|
+
logLevel?: "error" | "log" | "debug" | "info" | "warn" | "none" | undefined;
|
|
16
16
|
verbose?: boolean | undefined;
|
|
17
17
|
skipTelemetry?: boolean | undefined;
|
|
18
18
|
}>;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { intro, log, outro } from "@clack/prompts";
|
|
2
2
|
import { getBranch, prepareDeploymentError, tryCatch } from "@trigger.dev/core/v3";
|
|
3
|
+
import { DeploymentEventFromString, } from "@trigger.dev/core/v3/schemas";
|
|
3
4
|
import { Option as CommandOption } from "commander";
|
|
4
|
-
import { resolve } from "node:path";
|
|
5
|
+
import { join, relative, resolve } from "node:path";
|
|
5
6
|
import { isCI } from "std-env";
|
|
6
7
|
import { x } from "tinyexec";
|
|
7
8
|
import { z } from "zod";
|
|
9
|
+
import chalk from "chalk";
|
|
8
10
|
import { buildWorker } from "../build/buildWorker.js";
|
|
9
11
|
import { resolveAlwaysExternal } from "../build/externals.js";
|
|
10
|
-
import {
|
|
12
|
+
import { createContextArchive, getArchiveSize } from "../deploy/archiveContext.js";
|
|
13
|
+
import { S2 } from "@s2-dev/streamstore";
|
|
14
|
+
import { mkdir, readFile, unlink } from "node:fs/promises";
|
|
15
|
+
import { CommonCommandOptions, commonOptions, handleTelemetry, OutroCommandError, SkipLoggingError, wrapCommandAction, } from "../cli/common.js";
|
|
11
16
|
import { loadConfig } from "../config.js";
|
|
12
17
|
import { buildImage } from "../deploy/buildImage.js";
|
|
13
18
|
import { checkLogsForErrors, checkLogsForWarnings, printErrors, printWarnings, saveLogs, } from "../deploy/logs.js";
|
|
14
|
-
import { chalkError, cliLink, isLinksSupported, prettyError, prettyWarning, } from "../utilities/cliOutput.js";
|
|
19
|
+
import { chalkError, chalkGrey, chalkWarning, cliLink, isLinksSupported, prettyError, prettyWarning, } from "../utilities/cliOutput.js";
|
|
15
20
|
import { loadDotEnvVars } from "../utilities/dotEnv.js";
|
|
16
21
|
import { isDirectory } from "../utilities/fileSystem.js";
|
|
17
22
|
import { setGithubActionsOutputAndEnvVars } from "../utilities/githubActions.js";
|
|
@@ -40,10 +45,14 @@ const DeployCommandOptions = CommonCommandOptions.extend({
|
|
|
40
45
|
envFile: z.string().optional(),
|
|
41
46
|
// Local build options
|
|
42
47
|
forceLocalBuild: z.boolean().optional(),
|
|
48
|
+
localBuild: z.boolean().optional(),
|
|
43
49
|
useRegistryCache: z.boolean().default(false),
|
|
44
50
|
network: z.enum(["default", "none", "host"]).optional(),
|
|
45
51
|
push: z.boolean().optional(),
|
|
46
52
|
builder: z.string().default("trigger"),
|
|
53
|
+
nativeBuildServer: z.boolean().default(false),
|
|
54
|
+
detach: z.boolean().default(false),
|
|
55
|
+
plain: z.boolean().default(false),
|
|
47
56
|
});
|
|
48
57
|
export function configureDeployCommand(program) {
|
|
49
58
|
return (commonOptions(program
|
|
@@ -67,14 +76,20 @@ export function configureDeployCommand(program) {
|
|
|
67
76
|
.addOption(new CommandOption("--no-load", "Do not load the built image into your local docker").hideHelp())
|
|
68
77
|
.addOption(new CommandOption("--save-logs", "If provided, will save logs even for successful builds").hideHelp())
|
|
69
78
|
// Local build options
|
|
70
|
-
.addOption(new CommandOption("--force-local-build", "
|
|
79
|
+
.addOption(new CommandOption("--force-local-build", "Deprecated alias for --local-build").implies({
|
|
80
|
+
localBuild: true,
|
|
81
|
+
}))
|
|
82
|
+
.addOption(new CommandOption("--local-build", "Build the deployment image locally"))
|
|
71
83
|
.addOption(new CommandOption("--push", "Push the image after local builds").hideHelp())
|
|
72
84
|
.addOption(new CommandOption("--no-push", "Do not push the image after local builds").hideHelp())
|
|
73
85
|
.addOption(new CommandOption("--network <mode>", "The networking mode for RUN instructions when building locally").hideHelp())
|
|
74
86
|
.addOption(new CommandOption("--builder <builder>", "The builder to use when building locally").hideHelp())
|
|
87
|
+
.addOption(new CommandOption("--native-build-server", "Use the native build server for building the image"))
|
|
88
|
+
.addOption(new CommandOption("--detach", "Return immediately after the deployment is queued, do not wait for the build to complete. Implies using the native build server.").implies({ nativeBuildServer: true }))
|
|
89
|
+
.addOption(new CommandOption("--plain", "Plain output").hideHelp())
|
|
75
90
|
.action(async (path, options) => {
|
|
76
91
|
await handleTelemetry(async () => {
|
|
77
|
-
await printStandloneInitialBanner(true);
|
|
92
|
+
await printStandloneInitialBanner(true, options.profile);
|
|
78
93
|
await deployCommand(path, options);
|
|
79
94
|
});
|
|
80
95
|
}));
|
|
@@ -85,7 +100,9 @@ export async function deployCommand(dir, options) {
|
|
|
85
100
|
});
|
|
86
101
|
}
|
|
87
102
|
async function _deployCommand(dir, options) {
|
|
88
|
-
|
|
103
|
+
if (!options.plain) {
|
|
104
|
+
intro(`Deploying project${options.skipPromotion ? " (without promotion)" : ""}`);
|
|
105
|
+
}
|
|
89
106
|
if (!options.skipUpdateCheck) {
|
|
90
107
|
await updateTriggerPackages(dir, { ...options }, true, true);
|
|
91
108
|
}
|
|
@@ -96,6 +113,7 @@ async function _deployCommand(dir, options) {
|
|
|
96
113
|
embedded: true,
|
|
97
114
|
defaultApiUrl: options.apiUrl,
|
|
98
115
|
profile: options.profile,
|
|
116
|
+
silent: options.plain,
|
|
99
117
|
});
|
|
100
118
|
if (!authorization.ok) {
|
|
101
119
|
if (authorization.error === "fetch failed") {
|
|
@@ -160,10 +178,21 @@ async function _deployCommand(dir, options) {
|
|
|
160
178
|
if (!projectClient) {
|
|
161
179
|
throw new Error("Failed to get project client");
|
|
162
180
|
}
|
|
181
|
+
if (options.nativeBuildServer) {
|
|
182
|
+
await handleNativeBuildServerDeploy({
|
|
183
|
+
apiClient: projectClient.client,
|
|
184
|
+
config: resolvedConfig,
|
|
185
|
+
dashboardUrl: authorization.dashboardUrl,
|
|
186
|
+
options,
|
|
187
|
+
userId: authorization.auth.tokenType === "personal" ? authorization.userId : undefined,
|
|
188
|
+
gitMeta,
|
|
189
|
+
});
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
163
192
|
const serverEnvVars = await projectClient.client.getEnvironmentVariables(resolvedConfig.project);
|
|
164
193
|
loadDotEnvVars(resolvedConfig.workingDir, options.envFile);
|
|
165
194
|
const destination = getTmpDir(resolvedConfig.workingDir, "build", options.dryRun);
|
|
166
|
-
const $buildSpinner = spinner();
|
|
195
|
+
const $buildSpinner = spinner({ plain: options.plain });
|
|
167
196
|
const forcedExternals = await resolveAlwaysExternal(projectClient.client);
|
|
168
197
|
const { features } = resolvedConfig;
|
|
169
198
|
const [error, buildManifest] = await tryCatch(buildWorker({
|
|
@@ -175,6 +204,7 @@ async function _deployCommand(dir, options) {
|
|
|
175
204
|
rewritePaths: true,
|
|
176
205
|
envVars: serverEnvVars.success ? serverEnvVars.data.variables : {},
|
|
177
206
|
forcedExternals,
|
|
207
|
+
plain: options.plain,
|
|
178
208
|
listener: {
|
|
179
209
|
onBundleStart() {
|
|
180
210
|
$buildSpinner.start("Building trigger code");
|
|
@@ -200,10 +230,11 @@ async function _deployCommand(dir, options) {
|
|
|
200
230
|
gitMeta,
|
|
201
231
|
type: features.run_engine_v2 ? "MANAGED" : "V1",
|
|
202
232
|
runtime: buildManifest.runtime,
|
|
233
|
+
isNativeBuild: false,
|
|
203
234
|
}, envVars.TRIGGER_EXISTING_DEPLOYMENT_ID);
|
|
204
|
-
const isLocalBuild = options.
|
|
235
|
+
const isLocalBuild = options.localBuild || !deployment.externalBuildData;
|
|
205
236
|
// Would be best to actually store this separately in the deployment object. This is an okay proxy for now.
|
|
206
|
-
const remoteBuildExplicitlySkipped = options.
|
|
237
|
+
const remoteBuildExplicitlySkipped = options.localBuild && !!deployment.externalBuildData;
|
|
207
238
|
// Fail fast if we know local builds will fail
|
|
208
239
|
if (isLocalBuild) {
|
|
209
240
|
const result = await x("docker", ["buildx", "version"]);
|
|
@@ -221,7 +252,7 @@ async function _deployCommand(dir, options) {
|
|
|
221
252
|
const numberOfEnvVars = Object.keys(childVars).length + Object.keys(parentVars).length;
|
|
222
253
|
const vars = numberOfEnvVars === 1 ? "var" : "vars";
|
|
223
254
|
if (!options.skipSyncEnvVars) {
|
|
224
|
-
const $spinner = spinner();
|
|
255
|
+
const $spinner = spinner({ plain: options.plain });
|
|
225
256
|
$spinner.start(`Syncing ${numberOfEnvVars} env ${vars} with the server`);
|
|
226
257
|
const uploadResult = await syncEnvVarsWithServer(projectClient.client, resolvedConfig.project, options.env, childVars, parentVars);
|
|
227
258
|
if (!uploadResult.success) {
|
|
@@ -243,10 +274,13 @@ async function _deployCommand(dir, options) {
|
|
|
243
274
|
const rawTestLink = `${authorization.dashboardUrl}/projects/v3/${resolvedConfig.project}/test?environment=${options.env === "prod" ? "prod" : "stg"}`;
|
|
244
275
|
const deploymentLink = cliLink("View deployment", rawDeploymentLink);
|
|
245
276
|
const testLink = cliLink("Test tasks", rawTestLink);
|
|
246
|
-
const $spinner = spinner();
|
|
247
|
-
const buildSuffix = isLocalBuild &&
|
|
248
|
-
const deploySuffix = isLocalBuild &&
|
|
249
|
-
if (
|
|
277
|
+
const $spinner = spinner({ plain: options.plain });
|
|
278
|
+
const buildSuffix = isLocalBuild && process.env.TRIGGER_LOCAL_BUILD_LABEL_DISABLED !== "1" ? " (local)" : "";
|
|
279
|
+
const deploySuffix = isLocalBuild && process.env.TRIGGER_LOCAL_BUILD_LABEL_DISABLED !== "1" ? " (local build)" : "";
|
|
280
|
+
if (options.plain) {
|
|
281
|
+
$spinner.start(`Building version ${version}${buildSuffix}`);
|
|
282
|
+
}
|
|
283
|
+
else if (isCI) {
|
|
250
284
|
log.step(`Building version ${version}\n`);
|
|
251
285
|
}
|
|
252
286
|
else {
|
|
@@ -280,7 +314,7 @@ async function _deployCommand(dir, options) {
|
|
|
280
314
|
compilationPath: destination.path,
|
|
281
315
|
buildEnvVars: buildManifest.build.env,
|
|
282
316
|
onLog: (logMessage) => {
|
|
283
|
-
if (isCI) {
|
|
317
|
+
if (options.plain || isCI) {
|
|
284
318
|
console.log(logMessage);
|
|
285
319
|
return;
|
|
286
320
|
}
|
|
@@ -299,7 +333,7 @@ async function _deployCommand(dir, options) {
|
|
|
299
333
|
});
|
|
300
334
|
logger.debug("Build result", buildResult);
|
|
301
335
|
const warnings = checkLogsForWarnings(buildResult.logs);
|
|
302
|
-
const canShowLocalBuildHint = !isLocalBuild &&
|
|
336
|
+
const canShowLocalBuildHint = !isLocalBuild && process.env.TRIGGER_LOCAL_BUILD_HINT_DISABLED !== "1";
|
|
303
337
|
const buildFailed = !warnings.ok || !buildResult.ok;
|
|
304
338
|
if (buildFailed && canShowLocalBuildHint) {
|
|
305
339
|
const providerStatus = await projectClient.client.getRemoteBuildProviderStatus();
|
|
@@ -331,7 +365,10 @@ async function _deployCommand(dir, options) {
|
|
|
331
365
|
}, buildResult.logs, $spinner);
|
|
332
366
|
throw new SkipLoggingError(errorData?.message ?? "Failed to get deployment with worker");
|
|
333
367
|
}
|
|
334
|
-
if (
|
|
368
|
+
if (options.plain) {
|
|
369
|
+
$spinner.message(`Deploying version ${version}${deploySuffix}`);
|
|
370
|
+
}
|
|
371
|
+
else if (isCI) {
|
|
335
372
|
log.step(`Deploying version ${version}${deploySuffix}\n`);
|
|
336
373
|
}
|
|
337
374
|
else {
|
|
@@ -347,7 +384,7 @@ async function _deployCommand(dir, options) {
|
|
|
347
384
|
skipPromotion: options.skipPromotion,
|
|
348
385
|
skipPushToRegistry: remoteBuildExplicitlySkipped,
|
|
349
386
|
}, (logMessage) => {
|
|
350
|
-
if (isCI) {
|
|
387
|
+
if (options.plain || isCI) {
|
|
351
388
|
console.log(logMessage);
|
|
352
389
|
return;
|
|
353
390
|
}
|
|
@@ -362,20 +399,32 @@ async function _deployCommand(dir, options) {
|
|
|
362
399
|
await failDeploy(projectClient.client, deployment, { name: "FinalizeError", message: finalizeResponse.error }, buildResult.logs, $spinner);
|
|
363
400
|
throw new SkipLoggingError("Failed to finalize deployment");
|
|
364
401
|
}
|
|
365
|
-
if (
|
|
402
|
+
if (options.plain) {
|
|
403
|
+
console.log(`Successfully deployed version ${version}${deploySuffix}`);
|
|
404
|
+
}
|
|
405
|
+
else if (isCI) {
|
|
366
406
|
log.step(`Successfully deployed version ${version}${deploySuffix}`);
|
|
367
407
|
}
|
|
368
408
|
else {
|
|
369
409
|
$spinner.stop(`Successfully deployed version ${version}${deploySuffix}`);
|
|
370
410
|
}
|
|
371
411
|
const taskCount = deploymentWithWorker.worker?.tasks.length ?? 0;
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
412
|
+
if (options.plain) {
|
|
413
|
+
console.log(`Version ${version} deployed with ${taskCount} detected task${taskCount === 1 ? "" : "s"}`);
|
|
414
|
+
if (process.env.TRIGGER_DEPLOYMENT_LINK_OUTPUT_DISABLED !== "1") {
|
|
415
|
+
console.log(`Deployment: ${rawDeploymentLink}`);
|
|
416
|
+
console.log(`Test: ${rawTestLink}`);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
outro(`Version ${version} deployed with ${taskCount} detected task${taskCount === 1 ? "" : "s"} ${isLinksSupported ? `| ${deploymentLink} | ${testLink}` : ""}`);
|
|
421
|
+
if (!isLinksSupported) {
|
|
422
|
+
console.log("View deployment");
|
|
423
|
+
console.log(rawDeploymentLink);
|
|
424
|
+
console.log(); // new line
|
|
425
|
+
console.log("Test tasks");
|
|
426
|
+
console.log(rawTestLink);
|
|
427
|
+
}
|
|
379
428
|
}
|
|
380
429
|
if (options.saveLogs) {
|
|
381
430
|
const logPath = await saveLogs(deployment.shortCode, buildResult.logs);
|
|
@@ -528,6 +577,259 @@ async function initializeOrAttachDeployment(apiClient, data, existingDeploymentI
|
|
|
528
577
|
}
|
|
529
578
|
return newDeploymentOrError.data;
|
|
530
579
|
}
|
|
580
|
+
async function handleNativeBuildServerDeploy({ apiClient, options, config, dashboardUrl, userId, gitMeta, }) {
|
|
581
|
+
const tmpDir = join(config.workingDir, ".trigger", "tmp");
|
|
582
|
+
await mkdir(tmpDir, { recursive: true });
|
|
583
|
+
const archivePath = join(tmpDir, `deploy-${Date.now()}.tar.gz`);
|
|
584
|
+
const $deploymentSpinner = spinner();
|
|
585
|
+
$deploymentSpinner.start("Preparing deployment files");
|
|
586
|
+
await createContextArchive(config.workspaceDir, archivePath);
|
|
587
|
+
const archiveSize = await getArchiveSize(archivePath);
|
|
588
|
+
const sizeMB = (archiveSize / 1024 / 1024).toFixed(2);
|
|
589
|
+
$deploymentSpinner.message(`Deployment files ready (${sizeMB} MB)`);
|
|
590
|
+
const artifactResult = await apiClient.createArtifact({
|
|
591
|
+
type: "deployment_context",
|
|
592
|
+
contentType: "application/gzip",
|
|
593
|
+
contentLength: archiveSize,
|
|
594
|
+
});
|
|
595
|
+
if (!artifactResult.success) {
|
|
596
|
+
$deploymentSpinner.stop("Failed creating deployment artifact");
|
|
597
|
+
log.error(chalk.bold(chalkError(artifactResult.error)));
|
|
598
|
+
throw new OutroCommandError(`Deployment failed`);
|
|
599
|
+
}
|
|
600
|
+
const { artifactKey, uploadUrl, uploadFields } = artifactResult.data;
|
|
601
|
+
logger.debug("Artifact created", { artifactKey });
|
|
602
|
+
$deploymentSpinner.message("Uploading deployment files");
|
|
603
|
+
const [readError, fileBuffer] = await tryCatch(readFile(archivePath));
|
|
604
|
+
if (readError) {
|
|
605
|
+
$deploymentSpinner.stop("Failed reading deployment archive");
|
|
606
|
+
log.error(chalk.bold(chalkError(readError.message)));
|
|
607
|
+
throw new OutroCommandError(`Deployment failed`);
|
|
608
|
+
}
|
|
609
|
+
const formData = new FormData();
|
|
610
|
+
for (const [key, value] of Object.entries(uploadFields)) {
|
|
611
|
+
formData.append(key, value);
|
|
612
|
+
}
|
|
613
|
+
const blob = new Blob([new Uint8Array(fileBuffer)], { type: "application/gzip" });
|
|
614
|
+
formData.append("file", blob, "deployment.tar.gz");
|
|
615
|
+
const [uploadError, uploadResponse] = await tryCatch(fetch(uploadUrl, {
|
|
616
|
+
method: "POST",
|
|
617
|
+
body: formData,
|
|
618
|
+
}));
|
|
619
|
+
if (uploadError || !uploadResponse?.ok) {
|
|
620
|
+
$deploymentSpinner.stop("Failed to upload deployment files");
|
|
621
|
+
log.error(chalk.bold(chalkError(`${uploadError?.message} (${uploadResponse?.statusText} ${uploadResponse?.status})`)));
|
|
622
|
+
throw new OutroCommandError(`Deployment failed`);
|
|
623
|
+
}
|
|
624
|
+
const [unlinkError] = await tryCatch(unlink(archivePath));
|
|
625
|
+
if (unlinkError) {
|
|
626
|
+
logger.debug("Failed to delete deployment artifact file", { archivePath, error: unlinkError });
|
|
627
|
+
}
|
|
628
|
+
$deploymentSpinner.message("Deployment files uploaded");
|
|
629
|
+
const configFilePath = config.configFile !== undefined
|
|
630
|
+
? relative(config.workspaceDir, config.configFile).replace(/\\/g, "/")
|
|
631
|
+
: undefined;
|
|
632
|
+
const initializeDeploymentResult = await apiClient.initializeDeployment({
|
|
633
|
+
contentHash: "-",
|
|
634
|
+
userId,
|
|
635
|
+
gitMeta,
|
|
636
|
+
type: config.features.run_engine_v2 ? "MANAGED" : "V1",
|
|
637
|
+
runtime: config.runtime,
|
|
638
|
+
isNativeBuild: true,
|
|
639
|
+
artifactKey,
|
|
640
|
+
skipPromotion: options.skipPromotion,
|
|
641
|
+
configFilePath,
|
|
642
|
+
});
|
|
643
|
+
if (!initializeDeploymentResult.success) {
|
|
644
|
+
$deploymentSpinner.stop("Failed to initialize deployment");
|
|
645
|
+
log.error(chalk.bold(chalkError(initializeDeploymentResult.error)));
|
|
646
|
+
throw new OutroCommandError(`Deployment failed`);
|
|
647
|
+
}
|
|
648
|
+
const deployment = initializeDeploymentResult.data;
|
|
649
|
+
const rawDeploymentLink = `${dashboardUrl}/projects/v3/${config.project}/deployments/${deployment.shortCode}`;
|
|
650
|
+
const rawTestLink = `${dashboardUrl}/projects/v3/${config.project}/test?environment=${options.env === "prod" ? "prod" : "stg"}`;
|
|
651
|
+
const exposedDeploymentLink = isLinksSupported
|
|
652
|
+
? cliLink(chalk.bold(rawDeploymentLink), rawDeploymentLink)
|
|
653
|
+
: chalk.bold(rawDeploymentLink);
|
|
654
|
+
$deploymentSpinner.stop("Deployment initialized");
|
|
655
|
+
log.info(`View deployment: ${exposedDeploymentLink}`);
|
|
656
|
+
setGithubActionsOutputAndEnvVars({
|
|
657
|
+
envVars: {
|
|
658
|
+
TRIGGER_DEPLOYMENT_VERSION: deployment.version,
|
|
659
|
+
TRIGGER_VERSION: deployment.version,
|
|
660
|
+
TRIGGER_DEPLOYMENT_SHORT_CODE: deployment.shortCode,
|
|
661
|
+
TRIGGER_DEPLOYMENT_URL: rawDeploymentLink,
|
|
662
|
+
TRIGGER_TEST_URL: rawTestLink,
|
|
663
|
+
},
|
|
664
|
+
outputs: {
|
|
665
|
+
deploymentVersion: deployment.version,
|
|
666
|
+
workerVersion: deployment.version,
|
|
667
|
+
deploymentShortCode: deployment.shortCode,
|
|
668
|
+
deploymentUrl: rawDeploymentLink,
|
|
669
|
+
testUrl: rawTestLink,
|
|
670
|
+
needsPromotion: options.skipPromotion ? "true" : "false",
|
|
671
|
+
},
|
|
672
|
+
});
|
|
673
|
+
if (options.detach) {
|
|
674
|
+
outro(`Version ${deployment.version} is being deployed`);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
const { eventStream } = deployment;
|
|
678
|
+
if (!eventStream) {
|
|
679
|
+
log.warn(`Failed streaming build logs, open the deployment in the dashboard to view the logs`);
|
|
680
|
+
outro(`Version ${deployment.version} is being deployed`);
|
|
681
|
+
return process.exit(0);
|
|
682
|
+
}
|
|
683
|
+
const $queuedSpinner = spinner();
|
|
684
|
+
$queuedSpinner.start("Build queued");
|
|
685
|
+
const abortController = new AbortController();
|
|
686
|
+
const s2 = new S2({ accessToken: eventStream.s2.accessToken });
|
|
687
|
+
const basin = s2.basin(eventStream.s2.basin);
|
|
688
|
+
const stream = basin.stream(eventStream.s2.stream);
|
|
689
|
+
const [readSessionError, readSession] = await tryCatch(stream.readSession({
|
|
690
|
+
seq_num: 0,
|
|
691
|
+
wait: 60 * 20, // 20 minutes
|
|
692
|
+
as: "bytes",
|
|
693
|
+
}, { signal: abortController.signal }));
|
|
694
|
+
if (readSessionError) {
|
|
695
|
+
$queuedSpinner.stop("Failed to query build progress");
|
|
696
|
+
log.warn(`Failed streaming build logs, open the deployment in the dashboard to view the logs`);
|
|
697
|
+
outro(`Version ${deployment.version} is being deployed ${isLinksSupported ? `| ${cliLink("View deployment", rawDeploymentLink)}` : ""}`);
|
|
698
|
+
return process.exit(0);
|
|
699
|
+
}
|
|
700
|
+
const decoder = new TextDecoder();
|
|
701
|
+
let finalDeploymentEvent;
|
|
702
|
+
let queuedSpinnerStopped = false;
|
|
703
|
+
for await (const record of readSession) {
|
|
704
|
+
const decoded = decoder.decode(record.body);
|
|
705
|
+
const result = DeploymentEventFromString.safeParse(decoded);
|
|
706
|
+
if (!result.success) {
|
|
707
|
+
logger.debug("Failed to parse deployment event, skipping", {
|
|
708
|
+
error: result.error,
|
|
709
|
+
record: decoded,
|
|
710
|
+
});
|
|
711
|
+
continue;
|
|
712
|
+
}
|
|
713
|
+
const event = result.data;
|
|
714
|
+
switch (event.type) {
|
|
715
|
+
case "log": {
|
|
716
|
+
if (record.seq_num === 0) {
|
|
717
|
+
$queuedSpinner.stop("Build started");
|
|
718
|
+
console.log("│");
|
|
719
|
+
queuedSpinnerStopped = true;
|
|
720
|
+
}
|
|
721
|
+
const formattedTimestamp = chalkGrey(new Date(record.timestamp).toLocaleTimeString("en-US", {
|
|
722
|
+
hour12: false,
|
|
723
|
+
hour: "2-digit",
|
|
724
|
+
minute: "2-digit",
|
|
725
|
+
second: "2-digit",
|
|
726
|
+
fractionalSecondDigits: 3,
|
|
727
|
+
}));
|
|
728
|
+
const { level, message } = event.data;
|
|
729
|
+
const formattedMessage = level === "error"
|
|
730
|
+
? chalk.bold(chalkError(message))
|
|
731
|
+
: level === "warn"
|
|
732
|
+
? chalkWarning(message)
|
|
733
|
+
: level === "debug"
|
|
734
|
+
? chalkGrey(message)
|
|
735
|
+
: message;
|
|
736
|
+
// We use console.log here instead of clack's logger as the current version does not support changing the line spacing.
|
|
737
|
+
// And the logs look verbose with the default spacing.
|
|
738
|
+
// We cannot upgrade because the newer versions introduced some weird issues with the spinner.
|
|
739
|
+
// Ideally, we'd use clack's `taskLog` to only show the recent n lines of logs as they are streamed, but that also seems brittle
|
|
740
|
+
// and has some issues with cursor movements/clearing lines that it shouldn't clear.
|
|
741
|
+
// We can revisit this on future versions of `@clack/prompts`.
|
|
742
|
+
console.log(`│ ${formattedTimestamp} ${formattedMessage}`);
|
|
743
|
+
break;
|
|
744
|
+
}
|
|
745
|
+
case "finalized": {
|
|
746
|
+
finalDeploymentEvent = event.data;
|
|
747
|
+
abortController.abort(); // stop the stream
|
|
748
|
+
break;
|
|
749
|
+
}
|
|
750
|
+
default: {
|
|
751
|
+
event;
|
|
752
|
+
logger.debug("Unknown deployment event, skipping", { event });
|
|
753
|
+
continue;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
if (!queuedSpinnerStopped && !finalDeploymentEvent) {
|
|
758
|
+
// unlikely that it happens in practice, only in rare corner cases
|
|
759
|
+
// the timeout would kick in earlier if the build server fails to dequeue the build
|
|
760
|
+
$queuedSpinner.stop("Log stream stopped");
|
|
761
|
+
log.error("Failed dequeueing build, please try again shortly");
|
|
762
|
+
throw new OutroCommandError(`Version ${deployment.version} ${isLinksSupported ? `| ${cliLink("View deployment", rawDeploymentLink)}` : ""}`);
|
|
763
|
+
}
|
|
764
|
+
if (!finalDeploymentEvent) {
|
|
765
|
+
log.error("Stopped receiving updates from the build server, please check the deployment status in the dashboard");
|
|
766
|
+
if (!isLinksSupported) {
|
|
767
|
+
log.info(`View deployment: ${rawDeploymentLink}`);
|
|
768
|
+
}
|
|
769
|
+
throw new OutroCommandError(`Version ${deployment.version} ${isLinksSupported ? `| ${cliLink("View deployment", rawDeploymentLink)}` : ""}`);
|
|
770
|
+
}
|
|
771
|
+
switch (finalDeploymentEvent.result) {
|
|
772
|
+
case "succeeded": {
|
|
773
|
+
queuedSpinnerStopped
|
|
774
|
+
? log.success("Deployment completed successfully")
|
|
775
|
+
: $queuedSpinner.stop("Deployment completed successfully");
|
|
776
|
+
if (finalDeploymentEvent.message) {
|
|
777
|
+
log.success(finalDeploymentEvent.message);
|
|
778
|
+
}
|
|
779
|
+
if (options.skipPromotion) {
|
|
780
|
+
log.info(`This deployment was not automatically promoted. You can promote in the dashboard or via the promote command, e.g, \`npx trigger.dev promote ${deployment.version}\`.`);
|
|
781
|
+
}
|
|
782
|
+
if (!isLinksSupported) {
|
|
783
|
+
log.info(`Test tasks: ${rawTestLink}`);
|
|
784
|
+
}
|
|
785
|
+
outro(`Version ${deployment.version} was deployed ${isLinksSupported
|
|
786
|
+
? `| ${cliLink("Test tasks", rawTestLink)} | ${cliLink("View deployment", rawDeploymentLink)}`
|
|
787
|
+
: ""}`);
|
|
788
|
+
return process.exit(0);
|
|
789
|
+
}
|
|
790
|
+
case "failed": {
|
|
791
|
+
if (!queuedSpinnerStopped) {
|
|
792
|
+
$queuedSpinner.stop("Deployment failed");
|
|
793
|
+
}
|
|
794
|
+
log.error(chalk.bold(chalkError("Deployment failed" +
|
|
795
|
+
(finalDeploymentEvent.message ? `: ${finalDeploymentEvent.message}` : ""))));
|
|
796
|
+
throw new OutroCommandError(`Version ${deployment.version} deployment failed ${isLinksSupported ? `| ${cliLink("View deployment", rawDeploymentLink)}` : ""}`);
|
|
797
|
+
}
|
|
798
|
+
case "timed_out": {
|
|
799
|
+
if (!queuedSpinnerStopped) {
|
|
800
|
+
$queuedSpinner.stop("Deployment timed out");
|
|
801
|
+
}
|
|
802
|
+
log.error(chalk.bold(chalkError("Deployment timed out" +
|
|
803
|
+
(finalDeploymentEvent.message ? `: ${finalDeploymentEvent.message}` : ""))));
|
|
804
|
+
throw new OutroCommandError(`Version ${deployment.version} deployment timed out ${isLinksSupported ? `| ${cliLink("View deployment", rawDeploymentLink)}` : ""}`);
|
|
805
|
+
}
|
|
806
|
+
case "canceled": {
|
|
807
|
+
if (!queuedSpinnerStopped) {
|
|
808
|
+
$queuedSpinner.stop("Deployment was canceled");
|
|
809
|
+
}
|
|
810
|
+
log.error(chalk.bold(chalkError("Deployment was canceled" +
|
|
811
|
+
(finalDeploymentEvent.message ? `: ${finalDeploymentEvent.message}` : ""))));
|
|
812
|
+
throw new OutroCommandError(`Version ${deployment.version} deployment canceled ${isLinksSupported ? `| ${cliLink("View deployment", rawDeploymentLink)}` : ""}`);
|
|
813
|
+
}
|
|
814
|
+
default: {
|
|
815
|
+
// This case is only relevant in case we extend the enum in the future.
|
|
816
|
+
// New enum values will not be treated as errors in older cli versions.
|
|
817
|
+
queuedSpinnerStopped
|
|
818
|
+
? log.success("Log stream finished")
|
|
819
|
+
: $queuedSpinner.stop("Log stream finished");
|
|
820
|
+
if (finalDeploymentEvent.message) {
|
|
821
|
+
log.message(finalDeploymentEvent.message);
|
|
822
|
+
}
|
|
823
|
+
if (!isLinksSupported) {
|
|
824
|
+
log.info(`Test tasks: ${rawTestLink}`);
|
|
825
|
+
}
|
|
826
|
+
outro(`Version ${deployment.version} ${isLinksSupported
|
|
827
|
+
? `| ${cliLink("Test tasks", rawTestLink)} | ${cliLink("View deployment", rawDeploymentLink)}`
|
|
828
|
+
: ""}`);
|
|
829
|
+
return process.exit(0);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
531
833
|
export function verifyDirectory(dir, projectPath) {
|
|
532
834
|
if (dir !== "." && !isDirectory(projectPath)) {
|
|
533
835
|
if (dir === "staging" || dir === "prod" || dir === "preview") {
|