From 4a663468e6981d8fbda834458c38b1792d542b2d Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 19 Sep 2024 12:40:00 -0700 Subject: [PATCH] [tailscale] runtime/debug: embed Tailscale toolchain git rev This is another take on #49 (which we stopped using?), and less intrusive, and also always on. This puts puts the the Tailscale Go toolchain's git rev in the binary, accessible as runtime/debug.TailscaleGitRev. Caller code will have to access it guarded by the "tailscale_go" build tag. Updates #49 Signed-off-by: Brad Fitzpatrick --- .github/workflows/build.yml | 2 ++ api/go1.99999.txt | 2 ++ src/runtime/debug/mod.go | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4972a145ee388b..4689fe93dcab86 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/tailscale-git-rev.txt - name: build run: cd src && ./make.bash env: diff --git a/api/go1.99999.txt b/api/go1.99999.txt index dd6ab70a2079fd..b05358550eabd2 100644 --- a/api/go1.99999.txt +++ b/api/go1.99999.txt @@ -9,3 +9,5 @@ pkg net, type SockTrace struct, DidWrite func(int) #58 pkg net, type SockTrace struct, WillCloseTCPConn func(syscall.RawConn) #58 pkg net, type SockTrace struct, WillOverwrite func(*SockTrace) #58 pkg net/http, func SetRoundTripEnforcer(func(*Request) error) #55 +pkg runtime/debug, const TailscaleGitRev = "TAILSCALE_GIT_REV_TO_BE_REPLACED_AT_BUILD_TIME" #104 +pkg runtime/debug, const TailscaleGitRev ideal-string #104 diff --git a/src/runtime/debug/mod.go b/src/runtime/debug/mod.go index a4705605b859a1..7e170391f9e71c 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