Skip to content

Commit

Permalink
feat: exit if docker buildx can't be found for self-hosted builds (#1475
Browse files Browse the repository at this point in the history
)

* 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
  • Loading branch information
ghostdevv authored Nov 18, 2024
1 parent 332854b commit 653d974
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/spicy-turkeys-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"trigger.dev": minor
---

feat: exit if docker buildx can't be found for self-hosted builds
2 changes: 1 addition & 1 deletion packages/cli-v3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"std-env": "^3.7.0",
"terminal-link": "^3.0.0",
"tiny-invariant": "^1.2.0",
"tinyexec": "^0.2.0",
"tinyexec": "^0.3.1",
"ws": "^8.18.0",
"xdg-app-paths": "^8.3.0",
"zod": "3.22.3",
Expand Down
12 changes: 12 additions & 0 deletions packages/cli-v3/src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { spinner } from "../utilities/windows.js";
import { login } from "./login.js";
import { updateTriggerPackages } from "./update.js";
import { resolveAlwaysExternal } from "../build/externals.js";
import { x } from "tinyexec";

const DeployCommandOptions = CommonCommandOptions.extend({
dryRun: z.boolean().default(false),
Expand Down Expand Up @@ -265,6 +266,17 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
);
}

if (options.selfHosted) {
const result = await x("docker", ["buildx", "version"]);

if (result.exitCode !== 0) {
logger.debug(`"docker buildx version" failed (${result.exitCode}):`, result);
throw new Error(
"Failed to find docker buildx. Please install it: https://github.com/docker/buildx#installing."
);
}
}

if (
buildManifest.deploy.sync &&
buildManifest.deploy.sync.env &&
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 653d974

Please sign in to comment.