From e723204205f7a383d94f93456af1a07fe642367a Mon Sep 17 00:00:00 2001 From: Suhaha Date: Thu, 2 Sep 2021 20:45:11 +0800 Subject: [PATCH] Release v2021.08.26.2 (#997) [skip pd_pr] * tweak: add fallback to keep compatibility in scenarios without inject distro info (#976) * update: release version --- cmd/tidb-dashboard/main.go | 1 - pkg/utils/distro/distro.go | 11 ++++++++++- pkg/utils/distro/populate/populate.go | 21 --------------------- release-version | 2 +- 4 files changed, 11 insertions(+), 24 deletions(-) delete mode 100644 pkg/utils/distro/populate/populate.go diff --git a/cmd/tidb-dashboard/main.go b/cmd/tidb-dashboard/main.go index d20f417fb2..f0be488058 100644 --- a/cmd/tidb-dashboard/main.go +++ b/cmd/tidb-dashboard/main.go @@ -47,7 +47,6 @@ import ( keyvisualregion "github.com/pingcap/tidb-dashboard/pkg/keyvisual/region" "github.com/pingcap/tidb-dashboard/pkg/swaggerserver" "github.com/pingcap/tidb-dashboard/pkg/uiserver" - _ "github.com/pingcap/tidb-dashboard/pkg/utils/distro/populate" "github.com/pingcap/tidb-dashboard/pkg/utils/version" ) diff --git a/pkg/utils/distro/distro.go b/pkg/utils/distro/distro.go index 4404a6e43d..8181fe72ee 100644 --- a/pkg/utils/distro/distro.go +++ b/pkg/utils/distro/distro.go @@ -27,7 +27,16 @@ func Replace(distro introData) { } func Data(k string) string { - d := data.Load().(introData) + var d introData + atomd := data.Load() + // we need a fallback to keep compatibility in scenarios without inject distro info + // related issue: https://github.com/pingcap/tidb-dashboard/issues/975 + if d == nil { + d = Resource + } else { + d = atomd.(introData) + } + if d[k] == "" { return k } diff --git a/pkg/utils/distro/populate/populate.go b/pkg/utils/distro/populate/populate.go deleted file mode 100644 index 6c76cf84c0..0000000000 --- a/pkg/utils/distro/populate/populate.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2021 PingCAP, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package populate - -import "github.com/pingcap/tidb-dashboard/pkg/utils/distro" - -func init() { - distro.Replace(distro.Resource) -} diff --git a/release-version b/release-version index 7706493c5a..6751dd3ca6 100644 --- a/release-version +++ b/release-version @@ -1,3 +1,3 @@ # This file specifies the TiDB Dashboard internal version, which will be printed in `--version` # and UI. In release branch, changing this file will result in publishing a new version and tag. -2021.08.26.1 +2021.08.26.2