From 0a56bf779289a5ffdd273073259f683694b9d66a Mon Sep 17 00:00:00 2001 From: yaowenc2 Date: Sat, 8 Aug 2026 16:47:08 -0700 Subject: [PATCH] =?UTF-8?q?fix(deploy):=20auto-install=20flyctl=20on=20Lin?= =?UTF-8?q?ux=20=E2=80=94=20source=20deploys=20dead-ended=20on=20a=20hand-?= =?UTF-8?q?install?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ensureFlyctl only auto-installed via brew on macOS; a fresh Linux machine (CI containers included — insta-e2e run 31284364163) got a hint and a failed build. Official installer into ~/.fly, and the current process extends its own PATH since the installer's shell-profile edit can't reach a running process. Still best-effort: on failure the same manual hint prints. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01LPyX5GsxHvWqLpPYiUCfb5 --- src/flyctl-build.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/flyctl-build.ts b/src/flyctl-build.ts index bfcf468..66b51f0 100644 --- a/src/flyctl-build.ts +++ b/src/flyctl-build.ts @@ -85,6 +85,21 @@ export async function ensureFlyctl(): Promise { info((await ok('brew', ['install', 'flyctl'], true)) ? 'flyctl installed ✓' : 'flyctl install failed — install manually: https://fly.io/docs/flyctl/install/') return } + if (process.platform === 'linux') { + // A fresh Linux machine (CI containers included — insta-e2e run 31284364163) has no flyctl + // and no brew; without this branch `insta deploy ` dead-ends on a hand-install of a + // third-party CLI. Official installer, pinned into ~/.fly; the current process extends its + // own PATH because the installer's shell-profile edit can't reach an already-running process. + info('flyctl not found — installing to ~/.fly (one-time)…') + const flyHome = `${process.env.HOME ?? '~'}/.fly` + const installed = await ok('sh', ['-c', `curl -fsSL https://fly.io/install.sh | FLYCTL_INSTALL="${flyHome}" sh`], true) + if (installed) { + process.env.PATH = `${process.env.PATH}:${flyHome}/bin` + if (await ok('flyctl', ['version'])) { info('flyctl installed ✓'); return } + } + info('flyctl install failed — install manually: https://fly.io/docs/flyctl/install/') + return + } info('flyctl (fly CLI) not found — install it to deploy from source: https://fly.io/docs/flyctl/install/') } catch { /* best-effort convenience */ } }