Skip to content

Commit

Permalink
chore(build): update Makefile and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
baurine committed Dec 22, 2023
1 parent 1f39ee0 commit eb69e4f
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 137 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/manual-create-pd-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ on:
workflow_dispatch:
inputs:
release_version:
description: "Release version, e.g. v2021.07.09.1"
description: "Release version, e.g. 2021.07.09.1"
required: true
pd_branchs:
description: 'PD branch, e.g. ["master", "release-7.6"]'
default: '["master"]'
required: true

jobs:
Expand All @@ -13,7 +17,8 @@ jobs:
strategy:
fail-fast: false
matrix:
branch: [master, release-5.4, release-6.1]
# https://stackoverflow.com/questions/69781005/combine-dynamic-github-workflow-matrix-with-input-values-and-predefined-values
branch: ${{ fromJson(github.event.inputs.pd_branchs) }}
name: Create PD PR - ${{ matrix.branch }}
steps:
- name: Check out PD code base
Expand All @@ -23,7 +28,7 @@ jobs:
ref: ${{ matrix.branch }}
- uses: actions/setup-go@v3
with:
go-version: "1.18"
go-version: "1.21"
- name: Load go module cache
uses: actions/cache@v3
with:
Expand All @@ -35,23 +40,17 @@ jobs:
${{ runner.os }}-go-pd-
- 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
cd tests/client
go mod tidy
cd ../..
scripts/update-dashboard.sh ${{ github.event.inputs.release_version }}
- name: Commit PD code base change
id: git_commit
run: |
git diff
git config user.name "tidb-dashboard-bot"
git config user.email "tidb-dashboard-bot@pingcap.com"
git config user.name "baurine"
git config user.email "2008.hbl@gmail.com"
git add .
if git status | grep -q "Changes to be committed"
then
git commit --signoff --message "Update TiDB Dashboard to ${{ github.event.inputs.release_version }}, ref #4257"
git commit --signoff --message "Update TiDB Dashboard to v${{ github.event.inputs.release_version }}"
echo "::set-output name=committed::1"
else
echo "No changes detected, skipped"
Expand All @@ -65,19 +64,17 @@ jobs:
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 }}]
title: Update TiDB Dashboard to v${{ github.event.inputs.release_version }} [${{ matrix.branch }}]
body: |
### What problem does this PR solve?
Issue Number: ref #4257
Update TiDB Dashboard to ${{ github.event.inputs.release_version }}.
Upstream commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }} .
Update TiDB Dashboard to [v${{ github.event.inputs.release_version }}](https://github.com/pingcap/tidb-dashboard/releases/tag/v${{ github.event.inputs.release_version }}).
### Release note
```release-note
None
```
push-to-fork: tidb-dashboard-bot/pd
push-to-fork: baurine/pd
19 changes: 0 additions & 19 deletions .github/workflows/release-check.yaml

This file was deleted.

81 changes: 3 additions & 78 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Release

on:
push:
branches:
- release
tags:
- "v*"

jobs:
release:
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Lookup release version
id: lookup_release_version
run: |
echo "::set-output name=release_version::$(grep -v '^#' ./release-version)"
echo "::set-output name=release_version::$(git describe --tags --dirty --always)"
- name: Build UI
env:
REACT_APP_MIXPANEL_TOKEN: ${{ secrets.REACT_APP_MIXPANEL_TOKEN }}
Expand Down Expand Up @@ -85,78 +85,3 @@ jobs:
asset_path: ./embedded-assets-golang.zip
asset_name: embedded-assets-golang.zip
asset_content_type: application/zip
pd_pr:
if: "!contains(github.event.head_commit.message, 'skip pd_pr')"
name: Create PD PR
runs-on: ubuntu-latest
needs: release
strategy:
fail-fast: false
matrix:
branch: [master, release-5.4, release-6.1]
steps:
- name: Check out PD code base
uses: actions/checkout@v3
with:
repository: tikv/pd
ref: ${{ matrix.branch }}
- uses: actions/setup-go@v3
with:
go-version: "1.18"
- name: Load go module cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-pd-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-pd-
- name: Update TiDB Dashboard in PD code base
run: |
go get -d "github.com/pingcap/tidb-dashboard@${{ needs.release.outputs.release_version }}"
go mod tidy
make pd-server
go mod tidy
cd tests/client
go mod tidy
cd ../..
- name: Commit PD code base change
id: git_commit
run: |
git diff
git config user.name "tidb-dashboard-bot"
git config user.email "[email protected]"
git add .
if git status | grep -q "Changes to be committed"
then
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"
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 }}-${{ needs.release.outputs.release_version }}-${{ steps.build_id.outputs.id }}
title: Update TiDB Dashboard to ${{ needs.release.outputs.release_version }} [${{ matrix.branch }}]
body: |
### What problem does this PR solve?
Issue Number: ref #4257
This is an automatic updating PR for TiDB Dashboard. See #4257 for details.
This PR updates TiDB Dashboard to ${{ needs.release.outputs.release_version }} for upstream commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }} .
### Release note
```release-note
None
```
push-to-fork: tidb-dashboard-bot/pd
2 changes: 1 addition & 1 deletion .github/workflows/test-docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: docker/setup-buildx-action@v2
- name: Read VERSION file
id: getversion
run: echo "::set-output name=version::$(grep -v '^\#' ./release-version)"
run: echo "::set-output name=version::$(git describe --tags --dirty --always)"
- name: Build
uses: docker/build-push-action@v3
with:
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ E2E_SPEC ?=

UI ?=

RELEASE_VERSION := $(shell grep -v '^\#' ./release-version)
# RELEASE_VERSION := $(shell grep -v '^\#' ./release-version)
RELEASE_VERSION ?= $(shell git describe --tags --dirty --always)

LDFLAGS += -X "$(DASHBOARD_PKG)/pkg/utils/version.InternalVersion=$(RELEASE_VERSION)"
LDFLAGS += -X "$(DASHBOARD_PKG)/pkg/utils/version.Standalone=Yes"
Expand Down
2 changes: 0 additions & 2 deletions ui/.env.development
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
PORT=3001
PUBLIC_URL='/dashboard'
REACT_APP_VERSION=$npm_package_version
# REACT_APP_RELEASE_VERSION is set in config-overrides.js
REACT_APP_RELEASE_VERSION=unknown
REACT_APP_MIXPANEL_HOST=https://telemetry.pingcap.com/api/v1/dashboard/report
REACT_APP_MIXPANEL_TOKEN=
18 changes: 0 additions & 18 deletions ui/packages/tidb-dashboard-for-op/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,6 @@ const devServerParams = {
]
}

function getInternalVersion() {
const version = fs
.readFileSync('../../../release-version', 'utf8')
.split(os.EOL)
.map((l) => l.trim())
.filter((l) => !l.startsWith('#') && l !== '')[0]
if (version === '') {
throw new Error(
`invalid release version, please check the release-version file`
)
}
return version
}

function genDefine() {
const define = {}
for (const k in process.env) {
Expand All @@ -75,10 +61,6 @@ function genDefine() {
define[`process.env.${k}`] = JSON.stringify(envVal)
}
}
// REACT_APP_RELEASE_VERSION was used in sentry before
define['process.env.REACT_APP_RELEASE_VERSION'] = JSON.stringify(
getInternalVersion()
)
define['process.env.E2E_TEST'] = JSON.stringify(process.env.E2E_TEST)
return define
}
Expand Down

0 comments on commit eb69e4f

Please sign in to comment.