diff --git a/server/api/status.go b/server/api/status.go index f120608f71a..e0280f4b340 100644 --- a/server/api/status.go +++ b/server/api/status.go @@ -27,6 +27,7 @@ type statusHandler struct { type status struct { BuildTS string `json:"build_ts"` + Version string `json:"version"` GitHash string `json:"git_hash"` StartTimestamp int64 `json:"start_timestamp"` } @@ -42,6 +43,7 @@ func (h *statusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { version := status{ BuildTS: server.PDBuildTS, GitHash: server.PDGitHash, + Version: server.PDReleaseVersion, StartTimestamp: h.svr.StartTimestamp(), } diff --git a/server/api/status_test.go b/server/api/status_test.go index a7da0d776df..845d2ab7e6e 100644 --- a/server/api/status_test.go +++ b/server/api/status_test.go @@ -30,6 +30,7 @@ func checkStatusResponse(c *C, body []byte) { c.Assert(json.Unmarshal(body, &got), IsNil) c.Assert(got.BuildTS, Equals, server.PDBuildTS) c.Assert(got.GitHash, Equals, server.PDGitHash) + c.Assert(got.Version, Equals, server.PDReleaseVersion) } func (s *testStatusAPISuite) TestStatus(c *C) { diff --git a/server/api/version.go b/server/api/version.go index 15d43515a56..9aa902248e1 100644 --- a/server/api/version.go +++ b/server/api/version.go @@ -3,6 +3,7 @@ package api import ( "net/http" + "github.com/pingcap/pd/v3/server" "github.com/unrolled/render" ) @@ -22,7 +23,7 @@ func newVersionHandler(rd *render.Render) *versionHandler { func (h *versionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { version := &version{ - Version: "1.0.0", + Version: server.PDReleaseVersion, } h.rd.JSON(w, http.StatusOK, version) }