trigger.dev 0.0.0-v4-prerelease-20251107123438 → 0.0.0-v4-prerelease-20251204105839
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 +331 -27
- 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.d.ts +1 -0
- package/dist/esm/deploy/buildImage.js +19 -3
- 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 +12 -6
- package/dist/esm/entryPoints/dev-run-worker.js.map +1 -1
- package/dist/esm/entryPoints/managed-run-worker.js +12 -6
- package/dist/esm/entryPoints/managed-run-worker.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 +6 -0
- package/dist/esm/utilities/tempDirectories.js +11 -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,9 +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(),
|
|
49
|
+
useRegistryCache: z.boolean().default(false),
|
|
43
50
|
network: z.enum(["default", "none", "host"]).optional(),
|
|
44
51
|
push: z.boolean().optional(),
|
|
45
52
|
builder: z.string().default("trigger"),
|
|
53
|
+
nativeBuildServer: z.boolean().default(false),
|
|
54
|
+
detach: z.boolean().default(false),
|
|
55
|
+
plain: z.boolean().default(false),
|
|
46
56
|
});
|
|
47
57
|
export function configureDeployCommand(program) {
|
|
48
58
|
return (commonOptions(program
|
|
@@ -58,19 +68,28 @@ export function configureDeployCommand(program) {
|
|
|
58
68
|
.option("--skip-sync-env-vars", "Skip syncing environment variables when using the syncEnvVars extension.")
|
|
59
69
|
.option("--env-file <env file>", "Path to the .env file to load into the CLI process. Defaults to .env in the project directory.")
|
|
60
70
|
.option("--skip-promotion", "Skip promoting the deployment to the current deployment for the environment."))
|
|
61
|
-
.addOption(new CommandOption("--
|
|
71
|
+
.addOption(new CommandOption("--use-registry-cache", "Use the registry cache when building the image. The registry must be supported as a cache storage backend.").hideHelp())
|
|
72
|
+
.addOption(new CommandOption("--no-cache", "Do not use the cache when building the image. This will slow down the build process but can be useful if you are experiencing issues with the cache.")
|
|
73
|
+
.conflicts("useRegistryCache")
|
|
74
|
+
.hideHelp())
|
|
62
75
|
.addOption(new CommandOption("--load", "Load the built image into your local docker").hideHelp())
|
|
63
76
|
.addOption(new CommandOption("--no-load", "Do not load the built image into your local docker").hideHelp())
|
|
64
77
|
.addOption(new CommandOption("--save-logs", "If provided, will save logs even for successful builds").hideHelp())
|
|
65
78
|
// Local build options
|
|
66
|
-
.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"))
|
|
67
83
|
.addOption(new CommandOption("--push", "Push the image after local builds").hideHelp())
|
|
68
84
|
.addOption(new CommandOption("--no-push", "Do not push the image after local builds").hideHelp())
|
|
69
85
|
.addOption(new CommandOption("--network <mode>", "The networking mode for RUN instructions when building locally").hideHelp())
|
|
70
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())
|
|
71
90
|
.action(async (path, options) => {
|
|
72
91
|
await handleTelemetry(async () => {
|
|
73
|
-
await printStandloneInitialBanner(true);
|
|
92
|
+
await printStandloneInitialBanner(true, options.profile);
|
|
74
93
|
await deployCommand(path, options);
|
|
75
94
|
});
|
|
76
95
|
}));
|
|
@@ -81,7 +100,9 @@ export async function deployCommand(dir, options) {
|
|
|
81
100
|
});
|
|
82
101
|
}
|
|
83
102
|
async function _deployCommand(dir, options) {
|
|
84
|
-
|
|
103
|
+
if (!options.plain) {
|
|
104
|
+
intro(`Deploying project${options.skipPromotion ? " (without promotion)" : ""}`);
|
|
105
|
+
}
|
|
85
106
|
if (!options.skipUpdateCheck) {
|
|
86
107
|
await updateTriggerPackages(dir, { ...options }, true, true);
|
|
87
108
|
}
|
|
@@ -92,6 +113,7 @@ async function _deployCommand(dir, options) {
|
|
|
92
113
|
embedded: true,
|
|
93
114
|
defaultApiUrl: options.apiUrl,
|
|
94
115
|
profile: options.profile,
|
|
116
|
+
silent: options.plain,
|
|
95
117
|
});
|
|
96
118
|
if (!authorization.ok) {
|
|
97
119
|
if (authorization.error === "fetch failed") {
|
|
@@ -156,10 +178,21 @@ async function _deployCommand(dir, options) {
|
|
|
156
178
|
if (!projectClient) {
|
|
157
179
|
throw new Error("Failed to get project client");
|
|
158
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
|
+
}
|
|
159
192
|
const serverEnvVars = await projectClient.client.getEnvironmentVariables(resolvedConfig.project);
|
|
160
193
|
loadDotEnvVars(resolvedConfig.workingDir, options.envFile);
|
|
161
194
|
const destination = getTmpDir(resolvedConfig.workingDir, "build", options.dryRun);
|
|
162
|
-
const $buildSpinner = spinner();
|
|
195
|
+
const $buildSpinner = spinner({ plain: options.plain });
|
|
163
196
|
const forcedExternals = await resolveAlwaysExternal(projectClient.client);
|
|
164
197
|
const { features } = resolvedConfig;
|
|
165
198
|
const [error, buildManifest] = await tryCatch(buildWorker({
|
|
@@ -171,6 +204,7 @@ async function _deployCommand(dir, options) {
|
|
|
171
204
|
rewritePaths: true,
|
|
172
205
|
envVars: serverEnvVars.success ? serverEnvVars.data.variables : {},
|
|
173
206
|
forcedExternals,
|
|
207
|
+
plain: options.plain,
|
|
174
208
|
listener: {
|
|
175
209
|
onBundleStart() {
|
|
176
210
|
$buildSpinner.start("Building trigger code");
|
|
@@ -196,10 +230,11 @@ async function _deployCommand(dir, options) {
|
|
|
196
230
|
gitMeta,
|
|
197
231
|
type: features.run_engine_v2 ? "MANAGED" : "V1",
|
|
198
232
|
runtime: buildManifest.runtime,
|
|
233
|
+
isNativeBuild: false,
|
|
199
234
|
}, envVars.TRIGGER_EXISTING_DEPLOYMENT_ID);
|
|
200
|
-
const isLocalBuild = options.
|
|
235
|
+
const isLocalBuild = options.localBuild || !deployment.externalBuildData;
|
|
201
236
|
// Would be best to actually store this separately in the deployment object. This is an okay proxy for now.
|
|
202
|
-
const remoteBuildExplicitlySkipped = options.
|
|
237
|
+
const remoteBuildExplicitlySkipped = options.localBuild && !!deployment.externalBuildData;
|
|
203
238
|
// Fail fast if we know local builds will fail
|
|
204
239
|
if (isLocalBuild) {
|
|
205
240
|
const result = await x("docker", ["buildx", "version"]);
|
|
@@ -217,7 +252,7 @@ async function _deployCommand(dir, options) {
|
|
|
217
252
|
const numberOfEnvVars = Object.keys(childVars).length + Object.keys(parentVars).length;
|
|
218
253
|
const vars = numberOfEnvVars === 1 ? "var" : "vars";
|
|
219
254
|
if (!options.skipSyncEnvVars) {
|
|
220
|
-
const $spinner = spinner();
|
|
255
|
+
const $spinner = spinner({ plain: options.plain });
|
|
221
256
|
$spinner.start(`Syncing ${numberOfEnvVars} env ${vars} with the server`);
|
|
222
257
|
const uploadResult = await syncEnvVarsWithServer(projectClient.client, resolvedConfig.project, options.env, childVars, parentVars);
|
|
223
258
|
if (!uploadResult.success) {
|
|
@@ -239,10 +274,13 @@ async function _deployCommand(dir, options) {
|
|
|
239
274
|
const rawTestLink = `${authorization.dashboardUrl}/projects/v3/${resolvedConfig.project}/test?environment=${options.env === "prod" ? "prod" : "stg"}`;
|
|
240
275
|
const deploymentLink = cliLink("View deployment", rawDeploymentLink);
|
|
241
276
|
const testLink = cliLink("Test tasks", rawTestLink);
|
|
242
|
-
const $spinner = spinner();
|
|
243
|
-
const buildSuffix = isLocalBuild &&
|
|
244
|
-
const deploySuffix = isLocalBuild &&
|
|
245
|
-
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) {
|
|
246
284
|
log.step(`Building version ${version}\n`);
|
|
247
285
|
}
|
|
248
286
|
else {
|
|
@@ -255,6 +293,7 @@ async function _deployCommand(dir, options) {
|
|
|
255
293
|
}
|
|
256
294
|
const buildResult = await buildImage({
|
|
257
295
|
isLocalBuild,
|
|
296
|
+
useRegistryCache: options.useRegistryCache,
|
|
258
297
|
noCache: options.noCache,
|
|
259
298
|
deploymentId: deployment.id,
|
|
260
299
|
deploymentVersion: deployment.version,
|
|
@@ -275,7 +314,7 @@ async function _deployCommand(dir, options) {
|
|
|
275
314
|
compilationPath: destination.path,
|
|
276
315
|
buildEnvVars: buildManifest.build.env,
|
|
277
316
|
onLog: (logMessage) => {
|
|
278
|
-
if (isCI) {
|
|
317
|
+
if (options.plain || isCI) {
|
|
279
318
|
console.log(logMessage);
|
|
280
319
|
return;
|
|
281
320
|
}
|
|
@@ -294,7 +333,7 @@ async function _deployCommand(dir, options) {
|
|
|
294
333
|
});
|
|
295
334
|
logger.debug("Build result", buildResult);
|
|
296
335
|
const warnings = checkLogsForWarnings(buildResult.logs);
|
|
297
|
-
const canShowLocalBuildHint = !isLocalBuild &&
|
|
336
|
+
const canShowLocalBuildHint = !isLocalBuild && process.env.TRIGGER_LOCAL_BUILD_HINT_DISABLED !== "1";
|
|
298
337
|
const buildFailed = !warnings.ok || !buildResult.ok;
|
|
299
338
|
if (buildFailed && canShowLocalBuildHint) {
|
|
300
339
|
const providerStatus = await projectClient.client.getRemoteBuildProviderStatus();
|
|
@@ -326,7 +365,10 @@ async function _deployCommand(dir, options) {
|
|
|
326
365
|
}, buildResult.logs, $spinner);
|
|
327
366
|
throw new SkipLoggingError(errorData?.message ?? "Failed to get deployment with worker");
|
|
328
367
|
}
|
|
329
|
-
if (
|
|
368
|
+
if (options.plain) {
|
|
369
|
+
$spinner.message(`Deploying version ${version}${deploySuffix}`);
|
|
370
|
+
}
|
|
371
|
+
else if (isCI) {
|
|
330
372
|
log.step(`Deploying version ${version}${deploySuffix}\n`);
|
|
331
373
|
}
|
|
332
374
|
else {
|
|
@@ -342,7 +384,7 @@ async function _deployCommand(dir, options) {
|
|
|
342
384
|
skipPromotion: options.skipPromotion,
|
|
343
385
|
skipPushToRegistry: remoteBuildExplicitlySkipped,
|
|
344
386
|
}, (logMessage) => {
|
|
345
|
-
if (isCI) {
|
|
387
|
+
if (options.plain || isCI) {
|
|
346
388
|
console.log(logMessage);
|
|
347
389
|
return;
|
|
348
390
|
}
|
|
@@ -357,20 +399,32 @@ async function _deployCommand(dir, options) {
|
|
|
357
399
|
await failDeploy(projectClient.client, deployment, { name: "FinalizeError", message: finalizeResponse.error }, buildResult.logs, $spinner);
|
|
358
400
|
throw new SkipLoggingError("Failed to finalize deployment");
|
|
359
401
|
}
|
|
360
|
-
if (
|
|
402
|
+
if (options.plain) {
|
|
403
|
+
console.log(`Successfully deployed version ${version}${deploySuffix}`);
|
|
404
|
+
}
|
|
405
|
+
else if (isCI) {
|
|
361
406
|
log.step(`Successfully deployed version ${version}${deploySuffix}`);
|
|
362
407
|
}
|
|
363
408
|
else {
|
|
364
409
|
$spinner.stop(`Successfully deployed version ${version}${deploySuffix}`);
|
|
365
410
|
}
|
|
366
411
|
const taskCount = deploymentWithWorker.worker?.tasks.length ?? 0;
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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
|
+
}
|
|
374
428
|
}
|
|
375
429
|
if (options.saveLogs) {
|
|
376
430
|
const logPath = await saveLogs(deployment.shortCode, buildResult.logs);
|
|
@@ -523,6 +577,256 @@ async function initializeOrAttachDeployment(apiClient, data, existingDeploymentI
|
|
|
523
577
|
}
|
|
524
578
|
return newDeploymentOrError.data;
|
|
525
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 to upload deployment files");
|
|
597
|
+
throw new Error(`Failed to create deployment artifact: ${artifactResult.error}`);
|
|
598
|
+
}
|
|
599
|
+
const { artifactKey, uploadUrl, uploadFields } = artifactResult.data;
|
|
600
|
+
logger.debug("Artifact created", { artifactKey });
|
|
601
|
+
$deploymentSpinner.message("Uploading deployment files");
|
|
602
|
+
const [readError, fileBuffer] = await tryCatch(readFile(archivePath));
|
|
603
|
+
if (readError) {
|
|
604
|
+
$deploymentSpinner.stop("Failed to read deployment archive");
|
|
605
|
+
throw new Error(`Failed to read archive: ${readError.message}`);
|
|
606
|
+
}
|
|
607
|
+
const formData = new FormData();
|
|
608
|
+
for (const [key, value] of Object.entries(uploadFields)) {
|
|
609
|
+
formData.append(key, value);
|
|
610
|
+
}
|
|
611
|
+
const blob = new Blob([new Uint8Array(fileBuffer)], { type: "application/gzip" });
|
|
612
|
+
formData.append("file", blob, "deployment.tar.gz");
|
|
613
|
+
const [uploadError, uploadResponse] = await tryCatch(fetch(uploadUrl, {
|
|
614
|
+
method: "POST",
|
|
615
|
+
body: formData,
|
|
616
|
+
}));
|
|
617
|
+
if (uploadError || !uploadResponse?.ok) {
|
|
618
|
+
$deploymentSpinner.stop("Failed to upload deployment files");
|
|
619
|
+
throw new Error(`Failed to upload archive: ${uploadError?.message} ${uploadResponse?.status} ${uploadResponse?.statusText}`);
|
|
620
|
+
}
|
|
621
|
+
const [unlinkError] = await tryCatch(unlink(archivePath));
|
|
622
|
+
if (unlinkError) {
|
|
623
|
+
logger.debug("Failed to delete deployment artifact file", { archivePath, error: unlinkError });
|
|
624
|
+
}
|
|
625
|
+
$deploymentSpinner.message("Deployment files uploaded");
|
|
626
|
+
const configFilePath = config.configFile !== undefined
|
|
627
|
+
? relative(config.workspaceDir, config.configFile).replace(/\\/g, "/")
|
|
628
|
+
: undefined;
|
|
629
|
+
const initializeDeploymentResult = await apiClient.initializeDeployment({
|
|
630
|
+
contentHash: "-",
|
|
631
|
+
userId,
|
|
632
|
+
gitMeta,
|
|
633
|
+
type: config.features.run_engine_v2 ? "MANAGED" : "V1",
|
|
634
|
+
runtime: config.runtime,
|
|
635
|
+
isNativeBuild: true,
|
|
636
|
+
artifactKey,
|
|
637
|
+
skipPromotion: options.skipPromotion,
|
|
638
|
+
configFilePath,
|
|
639
|
+
});
|
|
640
|
+
if (!initializeDeploymentResult.success) {
|
|
641
|
+
$deploymentSpinner.stop("Failed to initialize deployment");
|
|
642
|
+
log.error(chalk.bold(chalkError(initializeDeploymentResult.error)));
|
|
643
|
+
throw new OutroCommandError(`Deployment failed`);
|
|
644
|
+
}
|
|
645
|
+
const deployment = initializeDeploymentResult.data;
|
|
646
|
+
const rawDeploymentLink = `${dashboardUrl}/projects/v3/${config.project}/deployments/${deployment.shortCode}`;
|
|
647
|
+
const rawTestLink = `${dashboardUrl}/projects/v3/${config.project}/test?environment=${options.env === "prod" ? "prod" : "stg"}`;
|
|
648
|
+
const exposedDeploymentLink = isLinksSupported
|
|
649
|
+
? cliLink(chalk.bold(rawDeploymentLink), rawDeploymentLink)
|
|
650
|
+
: chalk.bold(rawDeploymentLink);
|
|
651
|
+
$deploymentSpinner.stop("Deployment initialized");
|
|
652
|
+
log.info(`View deployment: ${exposedDeploymentLink}`);
|
|
653
|
+
setGithubActionsOutputAndEnvVars({
|
|
654
|
+
envVars: {
|
|
655
|
+
TRIGGER_DEPLOYMENT_VERSION: deployment.version,
|
|
656
|
+
TRIGGER_VERSION: deployment.version,
|
|
657
|
+
TRIGGER_DEPLOYMENT_SHORT_CODE: deployment.shortCode,
|
|
658
|
+
TRIGGER_DEPLOYMENT_URL: rawDeploymentLink,
|
|
659
|
+
TRIGGER_TEST_URL: rawTestLink,
|
|
660
|
+
},
|
|
661
|
+
outputs: {
|
|
662
|
+
deploymentVersion: deployment.version,
|
|
663
|
+
workerVersion: deployment.version,
|
|
664
|
+
deploymentShortCode: deployment.shortCode,
|
|
665
|
+
deploymentUrl: rawDeploymentLink,
|
|
666
|
+
testUrl: rawTestLink,
|
|
667
|
+
needsPromotion: options.skipPromotion ? "true" : "false",
|
|
668
|
+
},
|
|
669
|
+
});
|
|
670
|
+
if (options.detach) {
|
|
671
|
+
outro(`Version ${deployment.version} is being deployed`);
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
const { eventStream } = deployment;
|
|
675
|
+
if (!eventStream) {
|
|
676
|
+
log.warn(`Failed streaming build logs, open the deployment in the dashboard to view the logs`);
|
|
677
|
+
outro(`Version ${deployment.version} is being deployed`);
|
|
678
|
+
return process.exit(0);
|
|
679
|
+
}
|
|
680
|
+
const $queuedSpinner = spinner();
|
|
681
|
+
$queuedSpinner.start("Build queued");
|
|
682
|
+
const abortController = new AbortController();
|
|
683
|
+
const s2 = new S2({ accessToken: eventStream.s2.accessToken });
|
|
684
|
+
const basin = s2.basin(eventStream.s2.basin);
|
|
685
|
+
const stream = basin.stream(eventStream.s2.stream);
|
|
686
|
+
const [readSessionError, readSession] = await tryCatch(stream.readSession({
|
|
687
|
+
seq_num: 0,
|
|
688
|
+
wait: 60 * 20, // 20 minutes
|
|
689
|
+
as: "bytes",
|
|
690
|
+
}, { signal: abortController.signal }));
|
|
691
|
+
if (readSessionError) {
|
|
692
|
+
$queuedSpinner.stop("Failed to query build progress");
|
|
693
|
+
log.warn(`Failed streaming build logs, open the deployment in the dashboard to view the logs`);
|
|
694
|
+
outro(`Version ${deployment.version} is being deployed ${isLinksSupported ? `| ${cliLink("View deployment", rawDeploymentLink)}` : ""}`);
|
|
695
|
+
return process.exit(0);
|
|
696
|
+
}
|
|
697
|
+
const decoder = new TextDecoder();
|
|
698
|
+
let finalDeploymentEvent;
|
|
699
|
+
let queuedSpinnerStopped = false;
|
|
700
|
+
for await (const record of readSession) {
|
|
701
|
+
const decoded = decoder.decode(record.body);
|
|
702
|
+
const result = DeploymentEventFromString.safeParse(decoded);
|
|
703
|
+
if (!result.success) {
|
|
704
|
+
logger.debug("Failed to parse deployment event, skipping", {
|
|
705
|
+
error: result.error,
|
|
706
|
+
record: decoded,
|
|
707
|
+
});
|
|
708
|
+
continue;
|
|
709
|
+
}
|
|
710
|
+
const event = result.data;
|
|
711
|
+
switch (event.type) {
|
|
712
|
+
case "log": {
|
|
713
|
+
if (record.seq_num === 0) {
|
|
714
|
+
$queuedSpinner.stop("Build started");
|
|
715
|
+
console.log("│");
|
|
716
|
+
queuedSpinnerStopped = true;
|
|
717
|
+
}
|
|
718
|
+
const formattedTimestamp = chalkGrey(new Date(record.timestamp).toLocaleTimeString("en-US", {
|
|
719
|
+
hour12: false,
|
|
720
|
+
hour: "2-digit",
|
|
721
|
+
minute: "2-digit",
|
|
722
|
+
second: "2-digit",
|
|
723
|
+
fractionalSecondDigits: 3,
|
|
724
|
+
}));
|
|
725
|
+
const { level, message } = event.data;
|
|
726
|
+
const formattedMessage = level === "error"
|
|
727
|
+
? chalk.bold(chalkError(message))
|
|
728
|
+
: level === "warn"
|
|
729
|
+
? chalkWarning(message)
|
|
730
|
+
: level === "debug"
|
|
731
|
+
? chalkGrey(message)
|
|
732
|
+
: message;
|
|
733
|
+
// We use console.log here instead of clack's logger as the current version does not support changing the line spacing.
|
|
734
|
+
// And the logs look verbose with the default spacing.
|
|
735
|
+
// We cannot upgrade because the newer versions introduced some weird issues with the spinner.
|
|
736
|
+
// 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
|
|
737
|
+
// and has some issues with cursor movements/clearing lines that it shouldn't clear.
|
|
738
|
+
// We can revisit this on future versions of `@clack/prompts`.
|
|
739
|
+
console.log(`│ ${formattedTimestamp} ${formattedMessage}`);
|
|
740
|
+
break;
|
|
741
|
+
}
|
|
742
|
+
case "finalized": {
|
|
743
|
+
finalDeploymentEvent = event.data;
|
|
744
|
+
abortController.abort(); // stop the stream
|
|
745
|
+
break;
|
|
746
|
+
}
|
|
747
|
+
default: {
|
|
748
|
+
event;
|
|
749
|
+
logger.debug("Unknown deployment event, skipping", { event });
|
|
750
|
+
continue;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
if (!queuedSpinnerStopped && !finalDeploymentEvent) {
|
|
755
|
+
// unlikely that it happens in practice, only in rare corner cases
|
|
756
|
+
// the timeout would kick in earlier if the build server fails to dequeue the build
|
|
757
|
+
$queuedSpinner.stop("Log stream stopped");
|
|
758
|
+
log.error("Failed dequeueing build, please try again shortly");
|
|
759
|
+
throw new OutroCommandError(`Version ${deployment.version} ${isLinksSupported ? `| ${cliLink("View deployment", rawDeploymentLink)}` : ""}`);
|
|
760
|
+
}
|
|
761
|
+
if (!finalDeploymentEvent) {
|
|
762
|
+
log.error("Stopped receiving updates from the build server, please check the deployment status in the dashboard");
|
|
763
|
+
if (!isLinksSupported) {
|
|
764
|
+
log.info(`View deployment: ${rawDeploymentLink}`);
|
|
765
|
+
}
|
|
766
|
+
throw new OutroCommandError(`Version ${deployment.version} ${isLinksSupported ? `| ${cliLink("View deployment", rawDeploymentLink)}` : ""}`);
|
|
767
|
+
}
|
|
768
|
+
switch (finalDeploymentEvent.result) {
|
|
769
|
+
case "succeeded": {
|
|
770
|
+
queuedSpinnerStopped
|
|
771
|
+
? log.success("Deployment completed successfully")
|
|
772
|
+
: $queuedSpinner.stop("Deployment completed successfully");
|
|
773
|
+
if (finalDeploymentEvent.message) {
|
|
774
|
+
log.success(finalDeploymentEvent.message);
|
|
775
|
+
}
|
|
776
|
+
if (options.skipPromotion) {
|
|
777
|
+
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}\`.`);
|
|
778
|
+
}
|
|
779
|
+
if (!isLinksSupported) {
|
|
780
|
+
log.info(`Test tasks: ${rawTestLink}`);
|
|
781
|
+
}
|
|
782
|
+
outro(`Version ${deployment.version} was deployed ${isLinksSupported
|
|
783
|
+
? `| ${cliLink("Test tasks", rawTestLink)} | ${cliLink("View deployment", rawDeploymentLink)}`
|
|
784
|
+
: ""}`);
|
|
785
|
+
return process.exit(0);
|
|
786
|
+
}
|
|
787
|
+
case "failed": {
|
|
788
|
+
if (!queuedSpinnerStopped) {
|
|
789
|
+
$queuedSpinner.stop("Deployment failed");
|
|
790
|
+
}
|
|
791
|
+
log.error(chalk.bold(chalkError("Deployment failed" +
|
|
792
|
+
(finalDeploymentEvent.message ? `: ${finalDeploymentEvent.message}` : ""))));
|
|
793
|
+
throw new OutroCommandError(`Version ${deployment.version} deployment failed ${isLinksSupported ? `| ${cliLink("View deployment", rawDeploymentLink)}` : ""}`);
|
|
794
|
+
}
|
|
795
|
+
case "timed_out": {
|
|
796
|
+
if (!queuedSpinnerStopped) {
|
|
797
|
+
$queuedSpinner.stop("Deployment timed out");
|
|
798
|
+
}
|
|
799
|
+
log.error(chalk.bold(chalkError("Deployment timed out" +
|
|
800
|
+
(finalDeploymentEvent.message ? `: ${finalDeploymentEvent.message}` : ""))));
|
|
801
|
+
throw new OutroCommandError(`Version ${deployment.version} deployment timed out ${isLinksSupported ? `| ${cliLink("View deployment", rawDeploymentLink)}` : ""}`);
|
|
802
|
+
}
|
|
803
|
+
case "canceled": {
|
|
804
|
+
if (!queuedSpinnerStopped) {
|
|
805
|
+
$queuedSpinner.stop("Deployment was canceled");
|
|
806
|
+
}
|
|
807
|
+
log.error(chalk.bold(chalkError("Deployment was canceled" +
|
|
808
|
+
(finalDeploymentEvent.message ? `: ${finalDeploymentEvent.message}` : ""))));
|
|
809
|
+
throw new OutroCommandError(`Version ${deployment.version} deployment canceled ${isLinksSupported ? `| ${cliLink("View deployment", rawDeploymentLink)}` : ""}`);
|
|
810
|
+
}
|
|
811
|
+
default: {
|
|
812
|
+
// This case is only relevant in case we extend the enum in the future.
|
|
813
|
+
// New enum values will not be treated as errors in older cli versions.
|
|
814
|
+
queuedSpinnerStopped
|
|
815
|
+
? log.success("Log stream finished")
|
|
816
|
+
: $queuedSpinner.stop("Log stream finished");
|
|
817
|
+
if (finalDeploymentEvent.message) {
|
|
818
|
+
log.message(finalDeploymentEvent.message);
|
|
819
|
+
}
|
|
820
|
+
if (!isLinksSupported) {
|
|
821
|
+
log.info(`Test tasks: ${rawTestLink}`);
|
|
822
|
+
}
|
|
823
|
+
outro(`Version ${deployment.version} ${isLinksSupported
|
|
824
|
+
? `| ${cliLink("Test tasks", rawTestLink)} | ${cliLink("View deployment", rawDeploymentLink)}`
|
|
825
|
+
: ""}`);
|
|
826
|
+
return process.exit(0);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
526
830
|
export function verifyDirectory(dir, projectPath) {
|
|
527
831
|
if (dir !== "." && !isDirectory(projectPath)) {
|
|
528
832
|
if (dir === "staging" || dir === "prod" || dir === "preview") {
|