macOS: builds from source instead of downloading pre-built binaries; breaks with go.work files

未关闭
#287 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
github-actions, go, macos, typescript

调研方向

首先检查 action 的 macOS 路径、README 以及 Tailscale 的 build_dist.sh 行为。使用主机上的 go.work 文件重现故障,并将其与 Linux 和 Windows 的下载路径进行比较。完成的标准是修正 macOS 行为,或记录所需的 workaround 及其原因,并覆盖所报告的 workflow 场景。

由索引模型根据 Issue 内容生成。

描述

The action seems to have two related issues on macOS that are not documented anywhere in the README (at least I haven't found any mentions):

  1. macOS unconditionally compiles Tailscale from source instead of downloading a pre-built binary.
  2. The source build breaks when the host repo has a go.work file, with no documented workaround.

The workaround I found is setting GOWORK=off for the tailscale step:

- uses: tailscale/github-action@v4
  env:
    GOWORK: 'off'
AI-generated summary with more details

Problem 1: macOS always builds from source

On Linux and Windows the action downloads pre-built binaries from pkgs.tailscale.com/stable/. On macOS it takes a different path: it clones https://github.com/tailscale/tailscale.git, checks out the requested version tag, and compiles both tailscale and tailscaled by running build_dist.sh.

Pre-built macOS binaries are available on pkgs.tailscale.com/stable/ — the API response includes a MacZips field with links to universal .zip and .pkg files for every stable release. For example, for the default version 1.94.2:

  • https://pkgs.tailscale.com/stable/Tailscale-1.94.2-macos.zip (25.9 MB)
  • https://pkgs.tailscale.com/stable/Tailscale-1.94.2-macos.pkg (18.3 MB)

The action could download and extract these just as it does for Linux (.tgz) and Windows (.msi).

Impact: Compiling from source requires cloning the entire Tailscale repository and running a full Go build on every CI run that has a cold cache. This is significantly slower than downloading a pre-built binary.

If there is a reason macOS must build from source (e.g. code signing requirements, entitlements, notarization), that reason should be clearly documented in the README.


Problem 2: Source build breaks when the host repo has a go.work file

When the action runs on a macOS runner inside a checked-out repository that contains a go.work file, the source build fails with:

directory cmd/mkversion is contained in a module that is not one of the workspace modules listed in go.work. You can add the module to the workspace using:
	go work use .
/path/to/tailscale/build_dist.sh: line 32: VERSION_LONG: unbound variable

What happens: The action clones the Tailscale repository into the runner's working directory (typically a subdirectory of the host repo). When build_dist.sh runs go run ./cmd/mkversion, Go's workspace mode walks up the directory tree, finds the host repo's go.work file, and rejects the build because cmd/mkversion is not listed as a workspace module. Because build_dist.sh runs with set -u, the unbound VERSION_LONG variable then causes a hard abort.

Real-world failure: This broke CI in a consumer repo that uses a go.work file:
https://github.com/trivago/metafold/actions/runs/24346366481/job/71088404471

Workaround: Setting GOWORK=off in the environment before the action runs disables Go workspace mode and unblocks the build:

- uses: tailscale/github-action@v4
  env:
    GOWORK: 'off'

This workaround is not documented anywhere. The README makes no mention of the always-build-on-macOS behavior or its interaction with Go workspaces.


Requested changes

Either:

(a) Preferred: Download pre-built macOS binaries from pkgs.tailscale.com/stable/ instead of compiling from source, consistent with the Linux and Windows code paths.

(b) Alternative: If compiling from source on macOS is intentional and unavoidable, add the following to the README:

  • A note explaining that macOS always compiles Tailscale from source and why.
  • A note that the action must be run before checking out any repository that has a go.work file, or that GOWORK=off must be set in the environment before invoking the action.

Environment:

  • Action version: v4.1.2 (SHA 306e68a486fd2350f2bfc3b19fcd143891a4a2d8)
  • Tailscale version: 1.94.2 (action default)
  • Runner: macos-latest (macOS 15.7.4, ARM64)
  • Failure trigger: host repo has a go.work file at the root
主要语言
TypeScript
星标
938
派生
137
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

tailscale/github-action 的其他 Issue

查看 tailscale/github-action 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。