diff --git a/.github/workflows/compatibility-test.yml b/.github/workflows/compatibility-test.yml index 375f65b..7fd4380 100644 --- a/.github/workflows/compatibility-test.yml +++ b/.github/workflows/compatibility-test.yml @@ -22,20 +22,45 @@ jobs: - name: Get Connection Info run: | # delete cluster if exists + set +e ticloud cluster list 1372813089206721319 -o json > cluster + exitcode="$?" + if [[ "$exitcode" != "0" ]]; then + cat cluster + exit "$exitcode" + fi + total=$(jq '.total' cluster); for i in $(seq 1 $total); do id=`echo $(jq ".items[$i-1].id" cluster) | sed 's/"//g'` ticloud cluster delete -p 1372813089206721319 -c $id --force; + exitcode="$?" + if [[ "$exitcode" != "0" ]]; then + exit "$exitcode" + fi done # create cluster ticloud cluster create --project-id 1372813089206721319 --cluster-name tls-test --cloud-provider AWS -r us-east-1 --root-password ${{ secrets.TIDB_CLOUD_PASSWORD }} --cluster-type SERVERLESS; + exitcode="$?" + if [[ "$exitcode" != "0" ]]; then + exit "$exitcode" + fi + + # get connection info ticloud cluster list 1372813089206721319 -o json > cluster + exitcode="$?" + if [[ "$exitcode" != "0" ]]; then + cat cluster + exit "$exitcode" + fi + cat cluster echo "TIDB_CLOUD_USER=$(jq '.items[0].status.connection_strings.default_user' cluster)" >> $GITHUB_ENV echo "TIDB_CLOUD_HOST=$(jq '.items[0].status.connection_strings.standard.host' cluster)" >> $GITHUB_ENV + + outputs: TiDB_CLOUD_USER: ${{ env.TIDB_CLOUD_USER }} TiDB_CLOUD_HOST: ${{ env.TIDB_CLOUD_HOST }} diff --git a/.github/workflows/create-test.yml b/.github/workflows/create-test.yml index 95dc16b..6dc94f5 100644 --- a/.github/workflows/create-test.yml +++ b/.github/workflows/create-test.yml @@ -22,12 +22,23 @@ jobs: - name: Delete all serverless run: | # delete all serverless + set +e ticloud cluster list 1372813089447741295 -o json > cluster + exitcode="$?" + if [[ "$exitcode" != "0" ]]; then + cat cluster + exit "$exitcode" + fi + total=$(jq '.total' cluster); for i in $(seq 1 $total); do id=`echo $(jq ".items[$i-1].id" cluster) | sed 's/"//g'` ticloud cluster delete -p 1372813089447741295 -c $id --force; + exitcode="$?" + if [[ "$exitcode" != "0" ]]; then + exit "$exitcode" + fi done create-test: @@ -49,10 +60,23 @@ jobs: - name: Create cluster run: | + set +e PROJECT_ID=1372813089447741295 - ticloud cluster create -p $PROJECT_ID --cluster-name ${{ matrix.region }} --cloud-provider AWS -r ${{ matrix.region }} --root-password ${{ secrets.TIDB_CLOUD_PASSWORD }} --cluster-type SERVERLESS > ${{ matrix.region }} - cat ${{ matrix.region }} - ticloud cluster get -p $PROJECT_ID -c `cat ${{ matrix.region }} | sed 's/[^0-9]//g'` > ${{ matrix.region }} + result=`ticloud cluster create -p $PROJECT_ID --cluster-name ${{ matrix.region }} --cloud-provider AWS -r ${{ matrix.region }} --root-password ${{ secrets.TIDB_CLOUD_PASSWORD }} --cluster-type SERVERLESS` + exitcode="$?" + if [[ "$exitcode" != "0" ]]; then + echo $result + exit "$exitcode" + fi + echo $result + + id=`echo $result | sed 's/[^0-9]//g'` + ticloud cluster get -p $PROJECT_ID -c $id > ${{ matrix.region }} + exitcode="$?" + if [[ "$exitcode" != "0" ]]; then + cat ${{ matrix.region }} + exit "$exitcode" + fi cat ${{ matrix.region }} echo "PROJECT_ID=$PROJECT_ID" >> $GITHUB_ENV echo "CLUSTER_ID=`echo $(jq '.id' ${{ matrix.region }}) | sed 's/"//g'`" >> $GITHUB_ENV @@ -61,9 +85,22 @@ jobs: - name: Create branch run: | - ticloud branch create -c ${{ env.CLUSTER_ID }} --branch-name ${{ matrix.region }} > ${{ matrix.region }} - cat ${{ matrix.region }} - ticloud branch get -c ${{ env.CLUSTER_ID }} -b `cat ${{ matrix.region }} | grep -o 'bran-[a-zA-Z0-9]*'` > ${{ matrix.region }} + set +e + result=`ticloud branch create -c ${{ env.CLUSTER_ID }} --branch-name ${{ matrix.region }}` + exitcode="$?" + if [[ "$exitcode" != "0" ]]; then + echo $result + exit "$exitcode" + fi + echo $result + + id=`echo $result | grep -o 'bran-[a-zA-Z0-9]*'` + ticloud branch get -c ${{ env.CLUSTER_ID }} -b $id > ${{ matrix.region }} + exitcode="$?" + if [[ "$exitcode" != "0" ]]; then + cat ${{ matrix.region }} + exit "$exitcode" + fi cat ${{ matrix.region }} echo "BRANCH_ID=`echo $(jq '.id' ${{ matrix.region }}) | sed 's/"//g'`" >> $GITHUB_ENV