Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Cloudflared and use the new release for ARM64 #4289

Merged
merged 3 commits into from
Aug 8, 2024
Merged
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
5 changes: 5 additions & 0 deletions .changeset/khaki-shirts-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/plugin-cloudflare': patch
---

Upgrade cloudflared to 2024.8.2 and use the arm64 release
23 changes: 19 additions & 4 deletions packages/plugin-cloudflare/src/install-cloudflared.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('install-cloudflare', () => {
expect(global.fetch).not.toHaveBeenCalled()
})

test('install works when system is mac', async () => {
test('install works when system is mac and x64', async () => {
// Given
const env = {}

Expand All @@ -46,7 +46,22 @@ describe('install-cloudflare', () => {
// Then
// expect(global.fetch).not.toHaveBeenCalled()
expect(global.fetch).toHaveBeenCalledWith(
'https://github.com/cloudflare/cloudflared/releases/download/2024.6.1/cloudflared-darwin-amd64.tgz',
'https://github.com/cloudflare/cloudflared/releases/download/2024.8.2/cloudflared-darwin-amd64.tgz',
expect.anything(),
)
})

test('install works when system is mac and arm64', async () => {
// Given
const env = {}

// When
await install(env, 'darwin', 'arm64')

// Then
// expect(global.fetch).not.toHaveBeenCalled()
expect(global.fetch).toHaveBeenCalledWith(
'https://github.com/cloudflare/cloudflared/releases/download/2024.8.2/cloudflared-darwin-arm64.tgz',
expect.anything(),
)
})
Expand All @@ -61,7 +76,7 @@ describe('install-cloudflare', () => {
// Then
// expect(global.fetch).not.toHaveBeenCalled()
expect(global.fetch).toHaveBeenCalledWith(
'https://github.com/cloudflare/cloudflared/releases/download/2024.6.1/cloudflared-linux-amd64',
'https://github.com/cloudflare/cloudflared/releases/download/2024.8.2/cloudflared-linux-amd64',
expect.anything(),
)
})
Expand All @@ -75,7 +90,7 @@ describe('install-cloudflare', () => {

// Then
expect(global.fetch).toHaveBeenCalledWith(
'https://github.com/cloudflare/cloudflared/releases/download/2024.6.1/cloudflared-windows-amd64.exe',
'https://github.com/cloudflare/cloudflared/releases/download/2024.8.2/cloudflared-windows-amd64.exe',
expect.anything(),
)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-cloudflare/src/install-cloudflared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {pipeline} from 'stream'
// eslint-disable-next-line no-restricted-imports
import {execSync, execFileSync} from 'child_process'

export const CURRENT_CLOUDFLARE_VERSION = '2024.6.1'
export const CURRENT_CLOUDFLARE_VERSION = '2024.8.2'
const CLOUDFLARE_REPO = `https://github.com/cloudflare/cloudflared/releases/download/${CURRENT_CLOUDFLARE_VERSION}/`

const LINUX_URL: {[key: string]: string} = {
Expand All @@ -26,7 +26,7 @@ const LINUX_URL: {[key: string]: string} = {
}

const MACOS_URL: {[key: string]: string} = {
arm64: 'cloudflared-darwin-amd64.tgz',
arm64: 'cloudflared-darwin-arm64.tgz',
x64: 'cloudflared-darwin-amd64.tgz',
}

Expand Down
9 changes: 0 additions & 9 deletions packages/plugin-cloudflare/src/tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,6 @@ class TunnelClientInstance implements TunnelClient {
signal: this.abortController.signal,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
externalErrorHandler: async (error: any) => {
if (error.message.includes('Unknown system error -86')) {
// Cloudflare crashed because Rosetta 2 is not installed
this.currentStatus = {
status: 'error',
message: `Could not start Cloudflare tunnel: Missing Rosetta 2.`,
tryMessage: "Install it by running 'softwareupdate --install-rosetta' and try again",
}
return
}
// If already resolved, means that the CLI already received the tunnel URL.
// Can't retry because the CLI is running with an invalid URL
if (resolved) {
Expand Down
Loading