Skip to content

Commit

Permalink
This is an automated cherry-pick of tikv#7638
Browse files Browse the repository at this point in the history
close tikv#7637

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
baurine authored and ti-chi-bot committed Dec 29, 2023
1 parent f36f49b commit d03eb43
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/dashboard-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This file is updated by running scripts/update-dashboard.sh
# Don't edit it manullay
# the version will become X.Y.Z-<commit-short-hash> format later
2023.12.18.1
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

0 comments on commit d03eb43

Please sign in to comment.