Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions packages/shared/src/relayClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,44 @@ describe("RelayClient", () => {
),
);

it.effect("downloads the pinned x64 Windows asset on Windows ARM64", () => {
const requestedUrls: Array<string> = [];
return Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
const baseDir = yield* fileSystem.makeTempDirectoryScoped({
prefix: "t3-cloudflared-test-",
});
const manager = yield* makeCloudflaredRelayClient({ baseDir });

expect(yield* manager.resolve).toEqual({ status: "missing", version: CLOUDFLARED_VERSION });
const error = yield* manager.install.pipe(Effect.flip);
expect(requestedUrls).toEqual([
`https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-windows-amd64.exe`,
]);
expect(error.reason).toBe("invalid_checksum");
}).pipe(
Effect.scoped,
Effect.provide(
Layer.mergeAll(
NodeServices.layer,
Layer.succeed(
HttpClient.HttpClient,
HttpClient.make((request) =>
Effect.sync(() => {
requestedUrls.push(request.url);
return HttpClientResponse.fromWeb(request, new Response(new Uint8Array()));
}),
),
),
makeSpawnerLayer([]),
Layer.succeed(HostProcessPlatform, "win32"),
Layer.succeed(HostProcessArchitecture, "arm64"),
ConfigProvider.layer(ConfigProvider.fromEnv({ env: { PATH: "" } })),
),
),
);
});

it.effect.skipIf(windowsHost)("serializes concurrent installs within one runtime", () => {
const commands: Array<string> = [];
const bytes = new TextEncoder().encode("test-cloudflared-binary");
Expand Down
14 changes: 9 additions & 5 deletions packages/shared/src/relayClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ export interface CloudflaredReleaseAsset {
readonly archive: "binary" | "tgz";
}

const CLOUDFLARED_WINDOWS_AMD64_ASSET: CloudflaredReleaseAsset = {
url: "https://github.com/cloudflare/cloudflared/releases/download/2026.5.2/cloudflared-windows-amd64.exe",
sha256: "20b9638f685333d623798e733effbad2487093f15ba592f6c7752360ff3b7ab7",
archive: "binary",
};

const CLOUDFLARED_RELEASE_ASSETS: Readonly<
Partial<Record<`${NodeJS.Platform}-${string}`, CloudflaredReleaseAsset>>
> = {
Expand All @@ -91,11 +97,9 @@ const CLOUDFLARED_RELEASE_ASSETS: Readonly<
sha256: "5286698547f03df745adb2355f04c12dde52ef425491e81f433642d695521886",
archive: "binary",
},
"win32-x64": {
url: "https://github.com/cloudflare/cloudflared/releases/download/2026.5.2/cloudflared-windows-amd64.exe",
sha256: "20b9638f685333d623798e733effbad2487093f15ba592f6c7752360ff3b7ab7",
archive: "binary",
},
"win32-x64": CLOUDFLARED_WINDOWS_AMD64_ASSET,
// Cloudflare publishes no Windows ARM64 build; Windows 11 on ARM runs the x64 one under emulation.
"win32-arm64": CLOUDFLARED_WINDOWS_AMD64_ASSET,
};

const INSTALL_LOCK_RETRY_COUNT = 100;
Expand Down
Loading