fix(tunnel): extract cloudflared from .tgz on macOS#118
Merged
Conversation
The cloudflared downloader assumed every platform ships a bare binary at cloudflared-<os>-<arch>. That's true for Linux, but Cloudflare publishes macOS as cloudflared-darwin-<arch>.tgz (a gzip tar containing the binary). On darwin the old URL 404'd, so ephemerd could never start its managed cloudflared subprocess — webhook-tunnel startup failed on every Mac host. cloudflaredAsset now returns the correct URL + an isTgz flag per GOOS (darwin => .tgz, windows => .exe, else bare), and the darwin path gunzip/untars the `cloudflared` entry instead of chmod-ing the archive.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ephemerd's cloudflared downloader 404s on macOS, so the managed webhook tunnel never starts on Mac hosts (caught live enrolling a Mac mini runner).
Root cause: the downloader builds
cloudflared-<os>-<arch>and expects a bare binary. That holds for Linux, but Cloudflare ships macOS ascloudflared-darwin-<arch>.tgz— a gzip tar containing thecloudflaredbinary. The darwin URL had no.tgzsuffix (404), and even with it the file needs extraction, not a straight chmod.Change
cloudflaredAsset(version)returns the correct URL + anisTgzflag perGOOS: darwin →.tgz, windows →.exe, else bare binary.cloudflaredentry into<data-dir>/cloudflared/bin/cloudflared; other platforms keep the existing chmod+rename.Test plan
TestCloudflaredAsset— per-GOOS URL shape + isTgzTestExtractCloudflaredTgz/...MissingEntry— round-trip a synthesized archive; error when nocloudflaredentry.tgz-extracted binary on the Mac mini let ephemerd's tunnel connect (this makes that automatic)