Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dashboard): update TiDB Dashboard to v7.1.4-d74e7a85 [release-7.1] #7856

Merged
merged 4 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions build.ps1

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require (
github.com/pingcap/kvproto v0.0.0-20230407040905-68d0eebd564a
github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21
github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20
github.com/pingcap/tidb-dashboard v0.0.0-20240228084048-d74e7a853c69
github.com/prometheus/client_golang v1.11.1
github.com/prometheus/common v0.26.0
github.com/sasha-s/go-deadlock v0.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,8 @@ github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8
github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4=
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 h1:QV6jqlfOkh8hqvEAgwBZa+4bSgO0EeKC7s5c6Luam2I=
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21/go.mod h1:QYnjfA95ZaMefyl1NO8oPtKeb8pYUdnDVhQgf+qdpjM=
github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 h1:QRFMPcmEfhNod57i1yy6RMFZDXK17SmuOwfZs/wTfC8=
github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20/go.mod h1:EZ90+V5S4TttbYag6oKZ3jcNKRwZe1Mc9vXwOt9JBYw=
github.com/pingcap/tidb-dashboard v0.0.0-20240228084048-d74e7a853c69 h1:b7IYXAWl08Op1jhO98gQPHU0Zk/r5iywG5wYTR96Z5c=
github.com/pingcap/tidb-dashboard v0.0.0-20240228084048-d74e7a853c69/go.mod h1:ucZBRz52icb23T/5Z4CsuUHmarYiin7p2MeiVBe+o8c=
github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e h1:FBaTXU8C3xgt/drM58VHxojHo/QoG1oPsgWTGvaSpO4=
github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
Expand Down
3 changes: 3 additions & 0 deletions pkg/dashboard/adapter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ func GenDashboardConfig(srv *server.Server) (*config.Config, error) {
if dashboardCfg.ClusterTLSConfig, err = cfg.Security.ToTLSConfig(); err != nil {
return nil, err
}
if dashboardCfg.ClusterTLSInfo, err = cfg.Security.ToTLSInfo(); err != nil {
return nil, err
}
if dashboardCfg.TiDBTLSConfig, err = cfg.Dashboard.ToTiDBTLSConfig(); err != nil {
return nil, err
}
Expand Down
31 changes: 21 additions & 10 deletions pkg/utils/grpcutil/grpcutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ type TLSConfig struct {
SSLKEYBytes []byte
}

// ToTLSInfo converts TLSConfig to transport.TLSInfo.
func (s TLSConfig) ToTLSInfo() (*transport.TLSInfo, error) {
if len(s.CertPath) == 0 && len(s.KeyPath) == 0 {
return nil, nil
}
allowedCN, err := s.GetOneAllowedCN()
if err != nil {
return nil, err
}

return &transport.TLSInfo{
CertFile: s.CertPath,
KeyFile: s.KeyPath,
TrustedCAFile: s.CAPath,
AllowedCN: allowedCN,
}, nil
}

// ToTLSConfig generates tls config.
func (s TLSConfig) ToTLSConfig() (*tls.Config, error) {
if len(s.SSLCABytes) != 0 || len(s.SSLCertBytes) != 0 || len(s.SSLKEYBytes) != 0 {
Expand All @@ -68,19 +86,12 @@ func (s TLSConfig) ToTLSConfig() (*tls.Config, error) {
}, nil
}

if len(s.CertPath) == 0 && len(s.KeyPath) == 0 {
tlsInfo, err := s.ToTLSInfo()
if tlsInfo == nil {
return nil, nil
}
allowedCN, err := s.GetOneAllowedCN()
if err != nil {
return nil, err
}

tlsInfo := transport.TLSInfo{
CertFile: s.CertPath,
KeyFile: s.KeyPath,
TrustedCAFile: s.CAPath,
AllowedCN: allowedCN,
return nil, errs.ErrEtcdTLSConfig.Wrap(err).GenWithStackByCause()
}

tlsConfig, err := tlsInfo.ClientConfig()
Expand Down
3 changes: 3 additions & 0 deletions scripts/dashboard-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is updated by running scripts/update-dashboard.sh
# Don't edit it manullay
7.1.4-d74e7a85
4 changes: 3 additions & 1 deletion scripts/describe-dashboard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ DASHBOARD_DIR=$(go list -f "{{.Dir}}" -m github.com/pingcap/tidb-dashboard)
if [ "$1" = "git-hash" ]; then
echo "${DASHBOARD_DIR}" | awk -F- '{print $NF}'
elif [ "$1" = "internal-version" ]; then
grep -v '^#' "${DASHBOARD_DIR}/release-version"
CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BASE_DIR="$(dirname "$CUR_DIR")"
grep -v '^#' "$BASE_DIR/scripts/dashboard-version"
else
exit 1
fi
45 changes: 0 additions & 45 deletions scripts/embed-dashboard-ui.ps1

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/embed-dashboard-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ mkdir -p "${CACHE_DIR}"

function download_embed_asset {
echo '+ Discover TiDB Dashboard release version'
DASHBOARD_RELEASE_VERSION=$(grep -v '^#' "${DASHBOARD_DIR}/release-version")
DASHBOARD_RELEASE_VERSION=$(grep -v '^#' "${BASE_DIR}/scripts/dashboard-version")
echo " - TiDB Dashboard release version: ${DASHBOARD_RELEASE_VERSION}"

echo '+ Check whether pre-built assets are available'
Expand Down
51 changes: 51 additions & 0 deletions scripts/update-dashboard.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail

CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BASE_DIR="$(dirname "$CUR_DIR")"
DASHBOARD_VERSION_FILE="$BASE_DIR/scripts/dashboard-version"
# old version
DASHBOARD_VERSION=v$(grep -v '^#' "$DASHBOARD_VERSION_FILE")

# new version
# Usage: ./scripts/update-dashboard.sh <version>
# Example: ./scripts/update-dashboard.sh v7.6.0-f7bbcdcf
if [ "$#" -ge 1 ]; then
DASHBOARD_VERSION=$1

# if DASHBOARD_VERSION not start with `v`, then exit
if [[ ! $DASHBOARD_VERSION =~ ^v[0-9]+\. ]]; then
echo "Invalid dashboard version: $DASHBOARD_VERSION, it should start with \"v\""
exit 1
fi

# when writing to DASHBOARD_VERSION_FILE, remove the leading `v`,
# so that we don't need to modify the embed-dashboard-ui.sh logic
TO_FILE_VERSION=${DASHBOARD_VERSION#v}

echo "# This file is updated by running scripts/update-dashboard.sh" > $DASHBOARD_VERSION_FILE
echo "# Don't edit it manullay" >> $DASHBOARD_VERSION_FILE
echo $TO_FILE_VERSION >> $DASHBOARD_VERSION_FILE
fi

echo "+ Update dashboard version to $DASHBOARD_VERSION"

cd $BASE_DIR

# if DASHBOARD_VERSION match "vX.Y.Z-<commit-short-hash>" format,
# then extract the commit hash as tidb-dashboard target
if [[ $DASHBOARD_VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+-[0-9a-f]{7,8} ]]; then
DASHBOARD_VERSION=$(echo $DASHBOARD_VERSION | cut -d'-' -f2)
fi

go get -d github.com/pingcap/tidb-dashboard@$DASHBOARD_VERSION
go mod tidy
make pd-server
go mod tidy

cd tests/integrations/client
go mod tidy
cd ../mcs
go mod tidy
cd ../tso
go mod tidy
2 changes: 1 addition & 1 deletion tests/integrations/client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ require (
github.com/pingcap/errcode v0.3.0 // indirect
github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c // indirect
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 // indirect
github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 // indirect
github.com/pingcap/tidb-dashboard v0.0.0-20240228084048-d74e7a853c69 // indirect
github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/client/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8
github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4=
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 h1:QV6jqlfOkh8hqvEAgwBZa+4bSgO0EeKC7s5c6Luam2I=
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21/go.mod h1:QYnjfA95ZaMefyl1NO8oPtKeb8pYUdnDVhQgf+qdpjM=
github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 h1:QRFMPcmEfhNod57i1yy6RMFZDXK17SmuOwfZs/wTfC8=
github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20/go.mod h1:EZ90+V5S4TttbYag6oKZ3jcNKRwZe1Mc9vXwOt9JBYw=
github.com/pingcap/tidb-dashboard v0.0.0-20240228084048-d74e7a853c69 h1:b7IYXAWl08Op1jhO98gQPHU0Zk/r5iywG5wYTR96Z5c=
github.com/pingcap/tidb-dashboard v0.0.0-20240228084048-d74e7a853c69/go.mod h1:ucZBRz52icb23T/5Z4CsuUHmarYiin7p2MeiVBe+o8c=
github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e h1:FBaTXU8C3xgt/drM58VHxojHo/QoG1oPsgWTGvaSpO4=
github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/mcs/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ require (
github.com/pingcap/errcode v0.3.0 // indirect
github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c // indirect
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 // indirect
github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 // indirect
github.com/pingcap/tidb-dashboard v0.0.0-20240228084048-d74e7a853c69 // indirect
github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/mcs/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8
github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4=
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 h1:QV6jqlfOkh8hqvEAgwBZa+4bSgO0EeKC7s5c6Luam2I=
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21/go.mod h1:QYnjfA95ZaMefyl1NO8oPtKeb8pYUdnDVhQgf+qdpjM=
github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 h1:QRFMPcmEfhNod57i1yy6RMFZDXK17SmuOwfZs/wTfC8=
github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20/go.mod h1:EZ90+V5S4TttbYag6oKZ3jcNKRwZe1Mc9vXwOt9JBYw=
github.com/pingcap/tidb-dashboard v0.0.0-20240228084048-d74e7a853c69 h1:b7IYXAWl08Op1jhO98gQPHU0Zk/r5iywG5wYTR96Z5c=
github.com/pingcap/tidb-dashboard v0.0.0-20240228084048-d74e7a853c69/go.mod h1:ucZBRz52icb23T/5Z4CsuUHmarYiin7p2MeiVBe+o8c=
github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e h1:FBaTXU8C3xgt/drM58VHxojHo/QoG1oPsgWTGvaSpO4=
github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/tso/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ require (
github.com/pingcap/errors v0.11.5-0.20211224045212-9687c2b0f87c // indirect
github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 // indirect
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 // indirect
github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 // indirect
github.com/pingcap/tidb-dashboard v0.0.0-20240228084048-d74e7a853c69 // indirect
github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/tso/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3 h1:HR/ylkkLmGdSSDaD8
github.com/pingcap/log v1.1.1-0.20221110025148-ca232912c9f3/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4=
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 h1:QV6jqlfOkh8hqvEAgwBZa+4bSgO0EeKC7s5c6Luam2I=
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21/go.mod h1:QYnjfA95ZaMefyl1NO8oPtKeb8pYUdnDVhQgf+qdpjM=
github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20 h1:QRFMPcmEfhNod57i1yy6RMFZDXK17SmuOwfZs/wTfC8=
github.com/pingcap/tidb-dashboard v0.0.0-20230921035205-31ea86f64e20/go.mod h1:EZ90+V5S4TttbYag6oKZ3jcNKRwZe1Mc9vXwOt9JBYw=
github.com/pingcap/tidb-dashboard v0.0.0-20240228084048-d74e7a853c69 h1:b7IYXAWl08Op1jhO98gQPHU0Zk/r5iywG5wYTR96Z5c=
github.com/pingcap/tidb-dashboard v0.0.0-20240228084048-d74e7a853c69/go.mod h1:ucZBRz52icb23T/5Z4CsuUHmarYiin7p2MeiVBe+o8c=
github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e h1:FBaTXU8C3xgt/drM58VHxojHo/QoG1oPsgWTGvaSpO4=
github.com/pingcap/tipb v0.0.0-20220718022156-3e2483c20a9e/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
Expand Down
Loading