diff --git a/Makefile b/Makefile index aa5acb1bf0..830bb4b4de 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,10 @@ ifeq ($(UI),1) BUILD_TAGS += ui_server endif +ifeq ($(DISTRO_BUILD_TAG),1) + BUILD_TAGS += dashboard_distro +endif + LDFLAGS += -X "$(DASHBOARD_PKG)/pkg/utils/version.InternalVersion=$(shell grep -v '^\#' ./release-version)" LDFLAGS += -X "$(DASHBOARD_PKG)/pkg/utils/version.Standalone=Yes" LDFLAGS += -X "$(DASHBOARD_PKG)/pkg/utils/version.PDVersion=N/A" diff --git a/pkg/utils/distro/default_distro_info.go b/pkg/utils/distro/default_distro_info.go index 4f039f4412..aa263abf4f 100644 --- a/pkg/utils/distro/default_distro_info.go +++ b/pkg/utils/distro/default_distro_info.go @@ -1,4 +1,4 @@ -// +build !distro +// +build !dashboard_distro package distro diff --git a/pkg/utils/distro/distro.go b/pkg/utils/distro/distro.go index a9471a6f4e..25175d9d62 100644 --- a/pkg/utils/distro/distro.go +++ b/pkg/utils/distro/distro.go @@ -14,12 +14,22 @@ package distro -var data map[string]interface{} +import ( + "sync/atomic" +) -func Replace(distro map[string]interface{}) { - data = distro +type introData map[string]interface{} + +var data atomic.Value + +func Replace(distro introData) { + data.Store(distro) } func Data(k string) string { - return data[k].(string) + d := data.Load().(introData) + if d[k] == nil { + return k + } + return d[k].(string) } diff --git a/release-version b/release-version index c7ce6897e5..16ecf67ec9 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.07.21.1 +2021.07.23.1 diff --git a/scripts/generate_distro_info.sh b/scripts/generate_distro_info.sh index fa14dbf237..6ab66055a1 100755 --- a/scripts/generate_distro_info.sh +++ b/scripts/generate_distro_info.sh @@ -12,7 +12,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" PROJECT_DIR="$(dirname "$DIR")" if [ "${DISTRO_BUILD_TAG:-}" = "1" ]; then - BUILD_TAG_PARAMETER=distro + BUILD_TAG_PARAMETER=dashboard_distro else BUILD_TAG_PARAMETER="" fi diff --git a/scripts/lint.sh b/scripts/lint.sh index 63091c6686..568969660a 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -32,4 +32,4 @@ echo "+ Clean up go mod" go mod tidy echo "+ Run lints for docs" -npm_config_yes=true npx markdownlint-cli docs/**/*.md +npm_config_yes=true npx markdownlint-cli@0.27.0 docs/**/*.md