Skip to content

Commit

Permalink
Release v2021.12.30.1 [skip pd_pr] (#1113)
Browse files Browse the repository at this point in the history
* Revert "Release v2021.12.06.1 (#1084)"

This reverts commit bcc43a0.

* Compitable with different TiDB versions for conprof and non-root-login features (#1047)

* make conprof independent

* check feature enable

* add check feature enable middleware

* hide menu if feature is not enabled

* refactor non root login switch by new design

* i18n

* yarn fmt

* renaming

* adjust fe code

* refine

* remove unused log

* build(deps): bump ws from 5.2.2 to 5.2.3 in /ui (#1055)

* CICD: Update the release pipeline for recent PD format policies (#1054)

* fix i18n wording (#1056)

* Refactor: Change util module to util package (#1052)

* Refactor: Fix godot incorrectly add dot suffix to annotations (#1059)

* lint: Add goheader for copyright lints (#1062)

* Refactor: Migrate to use the `rest` package in util/ (#1060)

* fix(*): globally delete/update data by GORM (#1065)

* ui: bump dependencies (#1066)

* refactor: Switch to use ziputil, netutil, reflectutil and fileswap (#1067)

* Fix request header being pinned after pd profiling (#1069)

* Integrate speedscope (#1064)

* fix potential panic when GetPDInstances (#1075)

Signed-off-by: crazycs <chen.two.cs@gmail.com>

* Refactor: a new httpclient (#1073)

* Refactor: Switch to use util/distro in all places (#1078)

* chore: support import relative file URL (#1082)

* Refactor: Move tools into a standalone module (#1079)

* Fix script to embed the ui (#1088)

* Fix script to embed the ui

* Hack write_strings

* Refactor feature flag to support more modules (#1057)

* Drop sysutil dependency (#1093)

* chore: add graph generation (#1085)

* Refactor: Add TopologyProvider (#1098)

* esbuild: i18n + dep (#1101)

* script: Add a script to generate version matrix (#1104)

* distro: support dynamic config (#1094)

* chore: support multiple profiling types (#1095)

* fix(distro): check distro_strings.json fmt by prettier (#1106)

* script: fix generate assets (#1107)

* Add integration test (#1083)

* debug_api: Switch to use the new util (#1103)

* refactor(ui): auto refresh button (#1105)

* refactor(ui): auto refresh button

* chore: update translation

* fix: remain seconds

* refine: refresh button

* fix: onRefresh

* fix: auto refresh

* fix: continue tick

* chore: add some comments

* tweak: remaining refresh seconds

* chore: clean code

Co-authored-by: Wenxuan <breezewish@pingcap.com>

* ui: refine conprof (#1102)

* update wording

* not check prom any more

* replace time range component

* i18n

* support view profile by diffrent ways

* extract ActionsButton

* change download data format

* refine

* comments

* Revert "comments"

This reverts commit 3b03fdb.

* fix view cpu profile fail

* update state

* hide action button if disable

* address feedback

* update release-version

* sync with master

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wenxuan <breezewish@pingcap.com>
Co-authored-by: Suhaha <jklopsdfw@gmail.com>
Co-authored-by: Yini Xu <34967660+YiniXu9506@users.noreply.github.com>
Co-authored-by: crazycs <crazycs520@gmail.com>
  • Loading branch information
6 people committed Dec 30, 2021
1 parent bcc43a0 commit b2c4a04
Show file tree
Hide file tree
Showing 464 changed files with 25,777 additions and 13,573 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/manual-create-pd-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Create PD PR Manually

on:
workflow_dispatch:
inputs:
release_version:
description: "Release version, e.g. v2021.07.09.1"
required: true

jobs:
pd_pr:
name: Create PD PR
runs-on: ubuntu-latest
strategy:
matrix:
branch: [master, release-4.0, release-5.0, release-5.1]
steps:
- name: Check out PD code base
uses: actions/checkout@master
with:
repository: tikv/pd
ref: ${{ matrix.branch }}
- uses: actions/setup-go@v2
with:
go-version: "1.13.5"
- name: Update TiDB Dashboard in PD code base
run: |
go get -d "github.com/pingcap/tidb-dashboard@${{ github.event.inputs.release_version }}"
go mod tidy
make pd-server
go mod tidy
- name: Commit PD code base change
id: git_commit
run: |
git config user.name "tidb-dashboard-bot"
git config user.email "tidb-dashboard-bot@pingcap.com"
git add go.mod go.sum
if git status | grep -q "Changes to be committed"
then
git commit --signoff --message "Update TiDB Dashboard to ${{ github.event.inputs.release_version }}"
echo "::set-output name=committed::1"
else
echo "No changes detected, skipped"
fi
- name: Set build ID
id: build_id
run: echo "::set-output name=id::$(date +%s)"
- name: Create PR based on PD code base
uses: peter-evans/create-pull-request@v3
if: steps.git_commit.outputs.committed == 1
with:
token: ${{ secrets.BOT_PAT }}
branch: update-tidb-dashboard/${{ matrix.branch }}-${{ github.event.inputs.release_version }}-${{ steps.build_id.outputs.id }}
title: Update TiDB Dashboard to ${{ github.event.inputs.release_version }} [${{ matrix.branch }}]
body: |
### What problem does this PR solve?
Update TiDB Dashboard to ${{ github.event.inputs.release_version }}.
Upstream commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }} .
### Release note
```release-note
None
```
push-to-fork: tidb-dashboard-bot/pd
4 changes: 2 additions & 2 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: pull_request

jobs:
backend:
name: backend
name: Backend
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:
run: |
git diff --exit-code
frontend:
name: frontend
name: Frontend
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
needs: release
strategy:
matrix:
branch: [master, release-4.0, release-5.0, release-5.1, release-5.2]
branch: [master, release-5.3]
steps:
- name: Check out PD code base
uses: actions/checkout@master
Expand All @@ -111,7 +111,7 @@ jobs:
git add go.mod go.sum
if git status | grep -q "Changes to be committed"
then
git commit --signoff --message "Update TiDB Dashboard to ${{ needs.release.outputs.release_version }}"
git commit --signoff --message "Update TiDB Dashboard to ${{ needs.release.outputs.release_version }}, ref #4257"
echo "::set-output name=committed::1"
else
echo "No changes detected, skipped"
Expand All @@ -129,9 +129,9 @@ jobs:
body: |
### What problem does this PR solve?
Update TiDB Dashboard to ${{ needs.release.outputs.release_version }}.
This is an automatic updating PR for TiDB Dashboard. See #4257 for details.
Upstream commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }} .
This PR updates TiDB Dashboard to ${{ needs.release.outputs.release_version }} for upstream commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }} .
### Release note
Expand Down
59 changes: 58 additions & 1 deletion .github/workflows/e2e-test.yaml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,65 @@ on:
- release

jobs:
backend_ut:
name: Backend Unit Test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: "1.13.5"
- name: Load go module cache
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run unit test
run: |
make unit_test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./coverage/unit_test.txt
fail_ci_if_error: true
flags: be_unit_test
verbose: true
backend_integration:
name: Backend Integration Test
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
tidb_version: [latest, v4.0.1]
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: "1.13.5"
- name: Load go module cache
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run integration test
run: |
make integration_test TIDB_VERSION=${{ matrix.tidb_version }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./coverage/integration_${{ matrix.tidb_version }}.txt
fail_ci_if_error: true
flags: be_integration_test_${{ matrix.tidb_version }}
verbose: true
e2e_test:
name: UI
name: E2E
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand Down
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.env
/bin
/vendor

# Binaries for programs and plugins
*.exe
Expand All @@ -14,9 +13,7 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
coverage/

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
Expand Down
66 changes: 44 additions & 22 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,62 @@ run:
skip-dirs:
- swaggerspec
- pkg/uiserver
- ui
timeout: 2m

linters-settings:
goimports:
local-prefixes: github.com/pingcap/tidb-dashboard
golint:
min-confidence: 0

issues:
include:
# Bring back all gosec checks
- EXC0006
- EXC0007
- EXC0008
- EXC0009
- EXC0010
exclude-rules:
# TODO: Current code base does not work well for these linters. We should bring back one by one.
- path: ^pkg/|^cmd/
linters:
- nestif
- exhaustive
- wastedassign
- errorlint

linters:
disable-all: true
enable:
- govet
- errcheck
- staticcheck
- unused
- gosimple
- structcheck
- varcheck
- ineffassign
- deadcode
- typecheck
- revive
- gosec
- unconvert
- goimports
# Additionally enable some checkers
- asciicheck
- depguard
- prealloc
- dogsled
- durationcheck
- errorlint
- exhaustive
- exportloopref
- godot
- gofumpt
- goheader
- goimports
- gosec
- importas
- nestif
- prealloc
- predeclared
- revive
- rowserrcheck
- sqlclosecheck
- unconvert
- wastedassign
- whitespace

linters-settings:
goimports:
local-prefixes: github.com/pingcap/tidb-dashboard
exhaustive:
# only cover the case when default is not given
default-signifies-exhaustive: true
godot:
# exclude swag annotations
exclude:
- "^\\s*@"
goheader:
template: |-
Copyright {{ YEAR }} PingCAP, Inc. Licensed under Apache-2.0.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ yarn test
## Additional Guides

### Style Guidelines

This project follows the [Uber's Golang style guide](https://github.com/uber-go/guide/blob/master/style.md). Please refer to [its documentation](https://github.com/uber-go/guide/blob/master/style.md) for details.

### Swagger UI

We use [Swagger] to generate the API server and corresponding clients. Swagger provides a web UI in which you can
Expand Down
41 changes: 33 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.PHONY: install_tools lint dev yarn_dependencies ui server run

DASHBOARD_PKG := github.com/pingcap/tidb-dashboard

BUILD_TAGS ?=
Expand All @@ -10,40 +8,67 @@ ifeq ($(UI),1)
BUILD_TAGS += ui_server
endif

ifeq ($(DISTRO_BUILD_TAG),1)
BUILD_TAGS += 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"
LDFLAGS += -X "$(DASHBOARD_PKG)/pkg/utils/version.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S')"
LDFLAGS += -X "$(DASHBOARD_PKG)/pkg/utils/version.BuildGitHash=$(shell git rev-parse HEAD)"

TIDB_VERSION ?= latest

default: server

.PHONY: clean
clean:
rm -rf ./coverage

.PHONY: install_tools
install_tools:
scripts/install_go_tools.sh

.PHONY: lint
lint:
scripts/lint.sh

.PHONY: test
test: clean unit_test integration_test

.PHONY: unit_test
unit_test:
@mkdir -p ./coverage
GO111MODULE=on go test -v -cover -coverprofile=coverage/unit_test.txt ./pkg/... ./util/...

.PHONY: integration_test
integration_test:
@mkdir -p ./coverage
@TIDB_VERSION=${TIDB_VERSION} tests/run.sh

.PHONY: dev
dev: lint default

.PHONY: yarn_dependencies
yarn_dependencies: install_tools
cd ui &&\
yarn install --frozen-lockfile

.PHONY: ui
ui: yarn_dependencies
cd ui &&\
yarn build

server: install_tools
.PHONY: go_generate
go_generate: export PATH := $(shell pwd)/bin:$(PATH)
go_generate:
scripts/generate_swagger_spec.sh
go generate -x ./...

.PHONY: server
server: install_tools go_generate
ifeq ($(UI),1)
scripts/embed_ui_assets.sh
endif
go build -o bin/tidb-dashboard -ldflags '$(LDFLAGS)' -tags "${BUILD_TAGS}" cmd/tidb-dashboard/main.go

.PHONY: run
run:
bin/tidb-dashboard --debug --experimental --non-root-login
bin/tidb-dashboard --debug --experimental --feature-version "6.0.0"

0 comments on commit b2c4a04

Please sign in to comment.