From b8f5f021609e7777f1d07fcc07835957623bd8dd Mon Sep 17 00:00:00 2001 From: nolouch Date: Wed, 4 Mar 2020 14:25:59 +0800 Subject: [PATCH 1/3] api: fix the version Signed-off-by: nolouch --- server/api/status.go | 2 ++ server/api/status_test.go | 1 + server/api/version.go | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) 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..76c1ce83585 100644 --- a/server/api/version.go +++ b/server/api/version.go @@ -3,6 +3,7 @@ package api import ( "net/http" + "github.com/pingcap/pd/v4/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) } From 97ec1db87f2263a0bcaa96463dd95be848b86733 Mon Sep 17 00:00:00 2001 From: nolouch Date: Wed, 4 Mar 2020 15:25:59 +0800 Subject: [PATCH 2/3] fix version Signed-off-by: nolouch --- go.sum | 1 + server/api/version.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.sum b/go.sum index 44f8c3cb3b6..b6636a35202 100644 --- a/go.sum +++ b/go.sum @@ -235,6 +235,7 @@ github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9 h1:AJD9pZYm72vMgPcQDww github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd h1:CV3VsP3Z02MVtdpTMfEgRJ4T9NGgGTxdHpJerent7rM= github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= +github.com/pingcap/pd v2.1.19+incompatible h1:N/8HOd5yptSJZ1LdBa1bcvYOH9YCetvX4cg5fsGf9+c= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/server/api/version.go b/server/api/version.go index 76c1ce83585..9aa902248e1 100644 --- a/server/api/version.go +++ b/server/api/version.go @@ -3,7 +3,7 @@ package api import ( "net/http" - "github.com/pingcap/pd/v4/server" + "github.com/pingcap/pd/v3/server" "github.com/unrolled/render" ) From 164c8e1f8fbd289db570ab1578166446890f522b Mon Sep 17 00:00:00 2001 From: nolouch Date: Thu, 5 Mar 2020 18:51:34 +0800 Subject: [PATCH 3/3] fix ci Signed-off-by: nolouch --- go.sum | 1 - 1 file changed, 1 deletion(-) diff --git a/go.sum b/go.sum index b6636a35202..44f8c3cb3b6 100644 --- a/go.sum +++ b/go.sum @@ -235,7 +235,6 @@ github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9 h1:AJD9pZYm72vMgPcQDww github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd h1:CV3VsP3Z02MVtdpTMfEgRJ4T9NGgGTxdHpJerent7rM= github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= -github.com/pingcap/pd v2.1.19+incompatible h1:N/8HOd5yptSJZ1LdBa1bcvYOH9YCetvX4cg5fsGf9+c= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=