Upstream Database Switch #7440
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.21' | |
- 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: | | |
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@v2 | |
if: ${{ always() }} | |
with: | |
name: upstream-switch-logs | |
path: | | |
./logs | |
# send Slack notify if failed. | |
# NOTE: With the exception of `GITHUB_TOKEN`, secrets are not passed to the runner when a workflow is triggered from a forked repository. | |
- name: Slack notification | |
if: ${{ failure() }} | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFY }} | |
uses: Ilshidur/action-slack@2.1.0 | |
with: | |
args: "upstream-switch job failed, see https://github.com/pingcap/tiflow/actions/runs/{{ GITHUB_RUN_ID }}" |