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

[tailscale] runtime/debug: embed Tailscale toolchain git rev #104

Merged
merged 1 commit into from
Sep 19, 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
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions src/runtime/debug/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"strings"
)

const tailscaleGitRev = `TAILSCALE_GIT_REV_TO_BE_REPLACED_AT_BUILD_TIME`

// exported from runtime.
func modinfo() string

Expand All @@ -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
}

Expand Down