Upstream Database Switch #8612
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upstream Database Switch | |
on: | |
schedule: | |
- cron: '0 17-23 * * *' # run at minute 0 every hour from 01:00 ~ 07:00 UTC+8 | |
workflow_dispatch: | |
inputs: | |
pr: | |
description: 'Which PR do you want to trigger' | |
required: true | |
default: '' | |
jobs: | |
upstream-database-switch: | |
name: upstream-database-switch | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Set up Go env | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.23' | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Check out code by workflow dispatch | |
if: ${{ github.event.inputs.pr != '' }} | |
uses: actions/checkout@v2 | |
with: | |
ref: refs/pull/${{ github.event.inputs.pr }}/head | |
- name: Cache go modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-ticdc-${{ hashFiles('go.sum') }} | |
- name: Cache Tools | |
id: cache-tools | |
uses: actions/cache@v2 | |
with: | |
path: tools/bin | |
key: ${{ runner.os }}-ticdc-tools-${{ hashFiles('tools/check/go.sum') }} | |
- name: Build DM binary | |
run: make dm_integration_test_build | |
- name: Setup containers | |
run: | | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
docker-compose -f ./dm/tests/upstream_switch/docker-compose.yml up -d | |
- name: Run test cases | |
run: | | |
bash ./dm/tests/upstream_switch/case.sh | |
- name: Copy logs to hack permission | |
if: ${{ always() }} | |
run: | | |
mkdir ./logs | |
sudo cp -r -L /tmp/dm_test/upstream_switch/master/log ./logs/master | |
sudo cp -r -L /tmp/dm_test/upstream_switch/worker1/log ./logs/worker1 | |
sudo cp -r -L /tmp/dm_test/upstream_switch/worker2/log ./logs/worker2 | |
sudo chown -R runner ./logs | |
# Update logs as artifact seems not stable, so we set `continue-on-error: true` here. | |
- name: Upload logs | |
continue-on-error: true | |
uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: upstream-switch-logs | |
path: | | |
./logs | |
# Send feishu notification if failed. | |
- name: Feishu notification | |
continue-on-error: true | |
uses: foxundermoon/feishu-action@v2 | |
if: ${{ failure() }} | |
with: | |
url: ${{ secrets.ENGINE_FEISHU_NOTIFY_URL }} | |
msg_type: text | |
content: | | |
text: | | |
dm upstream switch job failed, see https://github.com/pingcap/tiflow/actions/runs/${{ github.run_id }} | |