From b90e495d02566b28e4d5bee3b160a6a293c0535e Mon Sep 17 00:00:00 2001 From: Juan Date: Wed, 25 Nov 2020 15:38:27 +0100 Subject: [PATCH] bump version to 7.10.2 --- beater/api/root/handler.go | 7 ++++--- beater/api/root/handler_test.go | 5 +++-- cmd/root.go | 3 ++- elasticsearch/client.go | 3 ++- {cmd => version}/version.go | 9 +++++++-- 5 files changed, 18 insertions(+), 9 deletions(-) rename {cmd => version}/version.go (83%) diff --git a/beater/api/root/handler.go b/beater/api/root/handler.go index 73620de4a0f..53dedb34c60 100644 --- a/beater/api/root/handler.go +++ b/beater/api/root/handler.go @@ -24,9 +24,10 @@ import ( "github.com/elastic/beats/v7/libbeat/common" "github.com/elastic/beats/v7/libbeat/monitoring" - "github.com/elastic/beats/v7/libbeat/version" + beatversion "github.com/elastic/beats/v7/libbeat/version" "github.com/elastic/apm-server/beater/request" + "github.com/elastic/apm-server/version" ) var ( @@ -40,8 +41,8 @@ var ( //TODO: only allow GET, HEAD requests (breaking change) func Handler() request.Handler { serverInfo := common.MapStr{ - "build_date": version.BuildTime().Format(time.RFC3339), - "build_sha": version.Commit(), + "build_date": beatversion.BuildTime().Format(time.RFC3339), + "build_sha": beatversion.Commit(), "version": version.GetDefaultVersion(), } diff --git a/beater/api/root/handler_test.go b/beater/api/root/handler_test.go index 2eb2b28c00b..760f3e8c3f9 100644 --- a/beater/api/root/handler_test.go +++ b/beater/api/root/handler_test.go @@ -26,11 +26,12 @@ import ( "github.com/stretchr/testify/assert" - "github.com/elastic/beats/v7/libbeat/version" + beatversion "github.com/elastic/beats/v7/libbeat/version" "github.com/elastic/apm-server/beater/authorization" "github.com/elastic/apm-server/beater/beatertest" "github.com/elastic/apm-server/beater/config" + "github.com/elastic/apm-server/version" ) func TestRootHandler(t *testing.T) { @@ -69,7 +70,7 @@ func TestRootHandler(t *testing.T) { assert.Equal(t, http.StatusOK, w.Code) body := fmt.Sprintf("{\"build_date\":\"0001-01-01T00:00:00Z\",\"build_sha\":\"%s\",\"version\":\"%s\"}\n", - version.Commit(), version.GetDefaultVersion()) + beatversion.Commit(), version.GetDefaultVersion()) assert.Equal(t, body, w.Body.String()) }) } diff --git a/cmd/root.go b/cmd/root.go index f7ca6097cd3..8082967b8ec 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -32,6 +32,7 @@ import ( "github.com/elastic/apm-server/idxmgmt" _ "github.com/elastic/apm-server/include" // include assets + "github.com/elastic/apm-server/version" ) const ( @@ -81,7 +82,7 @@ func NewRootCommand(newBeat beat.Creator) *cmd.BeatsRootCmd { settings := instance.Settings{ Name: beatName, IndexPrefix: apmIndexPattern, - Version: defaultBeatVersion, + Version: version.GetDefaultVersion(), RunFlags: runFlags, Monitoring: report.Settings{ DefaultUsername: "apm_system", diff --git a/elasticsearch/client.go b/elasticsearch/client.go index 631c8f4fcad..d1efeebb794 100644 --- a/elasticsearch/client.go +++ b/elasticsearch/client.go @@ -27,8 +27,9 @@ import ( "go.elastic.co/apm/module/apmelasticsearch" + "github.com/elastic/apm-server/version" + "github.com/elastic/beats/v7/libbeat/common" - "github.com/elastic/beats/v7/libbeat/version" esv7 "github.com/elastic/go-elasticsearch/v7" "github.com/elastic/go-elasticsearch/v7/esapi" esv8 "github.com/elastic/go-elasticsearch/v8" diff --git a/cmd/version.go b/version/version.go similarity index 83% rename from cmd/version.go rename to version/version.go index dd6cb69f2b4..a2931752d90 100644 --- a/cmd/version.go +++ b/version/version.go @@ -15,7 +15,12 @@ // specific language governing permissions and limitations // under the License. -package cmd +package version // name matches github.com/elastic/beats/v7/dev-tools/mage/settings.go parseBeatVersion -const defaultBeatVersion = "7.10.1" +const defaultBeatVersion = "7.10.2" + +func GetDefaultVersion() string { + // TODO replicate the libbeat logic (ie version qualifier) + return defaultBeatVersion +}