From 8feb4ff5d2c5875a60eeccdef18450e205dfbf47 Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Thu, 16 May 2024 10:31:44 -0400 Subject: [PATCH] version: add GitCommitTime to Meta Updates tailscale/corp#1297 Signed-off-by: Maisem Ali --- version/prop.go | 4 ++++ version/version.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/version/prop.go b/version/prop.go index b09bee7bb..fee76c65f 100644 --- a/version/prop.go +++ b/version/prop.go @@ -230,6 +230,9 @@ type Meta struct { // daemon, if requested. DaemonLong string `json:"daemonLong,omitempty"` + // GitCommitTime is the commit time of the git commit in GitCommit. + GitCommitTime string `json:"gitCommitTime,omitempty"` + // Cap is the current Tailscale capability version. It's a monotonically // incrementing integer that's incremented whenever a new capability is // added. @@ -245,6 +248,7 @@ func GetMeta() Meta { MajorMinorPatch: majorMinorPatch(), Short: Short(), Long: Long(), + GitCommitTime: getEmbeddedInfo().commitTime, GitCommit: gitCommit(), GitDirty: gitDirty(), ExtraGitCommit: extraGitCommitStamp, diff --git a/version/version.go b/version/version.go index 424ac47db..4b96d15ea 100644 --- a/version/version.go +++ b/version/version.go @@ -105,6 +105,7 @@ type embeddedInfo struct { valid bool commit string commitDate string + commitTime string dirty bool } @@ -126,6 +127,7 @@ func (i embeddedInfo) commitAbbrev() string { case "vcs.revision": ret.commit = s.Value case "vcs.time": + ret.commitTime = s.Value if len(s.Value) >= len("yyyy-mm-dd") { ret.commitDate = s.Value[:len("yyyy-mm-dd")] ret.commitDate = strings.ReplaceAll(ret.commitDate, "-", "")