diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4972a145ee388b..58af9abf41f042 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,6 +41,8 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: ref: ${{ inputs.ref || github.ref }} + - name: set runtime/debug.tailscaleGitRev + run: sed -i "s/TAILSCALE_GIT_REV_TO_BE_REPLACED_AT_BUILD_TIME/${{ github.sha }}/" src/runtime/debug/mod.go - name: build run: cd src && ./make.bash env: diff --git a/src/runtime/debug/mod.go b/src/runtime/debug/mod.go index a4705605b859a1..cbea7cd249ae7e 100644 --- a/src/runtime/debug/mod.go +++ b/src/runtime/debug/mod.go @@ -11,6 +11,8 @@ import ( "strings" ) +const tailscaleGitRev = `TAILSCALE_GIT_REV_TO_BE_REPLACED_AT_BUILD_TIME` + // exported from runtime. func modinfo() string @@ -34,6 +36,13 @@ func ReadBuildInfo() (info *BuildInfo, ok bool) { // awkwardness from the user. bi.GoVersion = runtime.Version() + if len(tailscaleGitRev) > 0 && tailscaleGitRev[0] != 'T' { + bi.Settings = append(bi.Settings, BuildSetting{ + Key: "tailscale.toolchain.rev", + Value: tailscaleGitRev, + }) + } + return bi, true }