Skip to content

Commit 653d974

Browse files
authored
feat: exit if docker buildx can't be found for self-hosted builds (#1475)
* feat: exit if docker buildx can't be found for self-hosted builds * chore: tweak debug log message * chore: improve error message based on rabbit's suggestion
1 parent 332854b commit 653d974

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

.changeset/spicy-turkeys-hug.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": minor
3+
---
4+
5+
feat: exit if docker buildx can't be found for self-hosted builds

packages/cli-v3/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
"std-env": "^3.7.0",
119119
"terminal-link": "^3.0.0",
120120
"tiny-invariant": "^1.2.0",
121-
"tinyexec": "^0.2.0",
121+
"tinyexec": "^0.3.1",
122122
"ws": "^8.18.0",
123123
"xdg-app-paths": "^8.3.0",
124124
"zod": "3.22.3",

packages/cli-v3/src/commands/deploy.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { spinner } from "../utilities/windows.js";
3737
import { login } from "./login.js";
3838
import { updateTriggerPackages } from "./update.js";
3939
import { resolveAlwaysExternal } from "../build/externals.js";
40+
import { x } from "tinyexec";
4041

4142
const DeployCommandOptions = CommonCommandOptions.extend({
4243
dryRun: z.boolean().default(false),
@@ -265,6 +266,17 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
265266
);
266267
}
267268

269+
if (options.selfHosted) {
270+
const result = await x("docker", ["buildx", "version"]);
271+
272+
if (result.exitCode !== 0) {
273+
logger.debug(`"docker buildx version" failed (${result.exitCode}):`, result);
274+
throw new Error(
275+
"Failed to find docker buildx. Please install it: https://github.com/docker/buildx#installing."
276+
);
277+
}
278+
}
279+
268280
if (
269281
buildManifest.deploy.sync &&
270282
buildManifest.deploy.sync.env &&

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)