From 9db8a4ade65b1e869af21fed6440b29825c7faf6 Mon Sep 17 00:00:00 2001 From: Johannes Nicolai Date: Tue, 22 Mar 2022 12:39:14 +0100 Subject: [PATCH 1/4] Better handling of edge cases --- .../cli-helper-scripts/wait-for-deploy-request-merged.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pscale/cli-helper-scripts/wait-for-deploy-request-merged.sh b/.pscale/cli-helper-scripts/wait-for-deploy-request-merged.sh index 3ddf151..1888837 100755 --- a/.pscale/cli-helper-scripts/wait-for-deploy-request-merged.sh +++ b/.pscale/cli-helper-scripts/wait-for-deploy-request-merged.sh @@ -37,16 +37,16 @@ function wait_for_deploy_request_merged { echo "Deploy request $number is not ready after $retries retries. Exiting..." return 2 fi - echo "Deploy-request $number is not merged yet. Current status:" + echo "Deploy-request $number is not deployed yet. Current status:" echo "show vitess_migrations\G" | pscale shell "$db" main --org "$org" echo "Retrying in $wait seconds..." sleep $wait - elif [ "$output" = "\"complete\"" ]; then - echo "Deploy-request $number has been merged successfully." + elif [ "$output" = "\"complete\"" ] || [ "$output" = "\"complete_pending_revert\"" ]; then + echo "Deploy-request $number has been deployed successfully." return 0 else echo "Deploy-request $number with unknown status: $output" return 3 fi done -} \ No newline at end of file +} From 6d10ba7cb11ec61b61e0e4f835e16e791d61192f Mon Sep 17 00:00:00 2001 From: Johannes Nicolai Date: Tue, 22 Mar 2022 12:40:49 +0100 Subject: [PATCH 2/4] Less use of merge vs deploy --- .pscale/cli-helper-scripts/ps-create-helper-functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pscale/cli-helper-scripts/ps-create-helper-functions.sh b/.pscale/cli-helper-scripts/ps-create-helper-functions.sh index 08007d0..9c306ad 100755 --- a/.pscale/cli-helper-scripts/ps-create-helper-functions.sh +++ b/.pscale/cli-helper-scripts/ps-create-helper-functions.sh @@ -220,7 +220,7 @@ function create-deployment { echo "Check out the deploy request status at $deploy_request" exit 5 else - echo "Check out the deploy request merged at $deploy_request" + echo "Check out the deploy request at $deploy_request" fi } From cdef97a05c347dbccfc8572c84a4de54bbd9207a Mon Sep 17 00:00:00 2001 From: Johannes Nicolai Date: Tue, 22 Mar 2022 12:42:25 +0100 Subject: [PATCH 3/4] Fall back to example-db --- .pscale/cli-helper-scripts/set-db-and-org-name.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pscale/cli-helper-scripts/set-db-and-org-name.sh b/.pscale/cli-helper-scripts/set-db-and-org-name.sh index 81fcaeb..7fa0ae9 100644 --- a/.pscale/cli-helper-scripts/set-db-and-org-name.sh +++ b/.pscale/cli-helper-scripts/set-db-and-org-name.sh @@ -1,5 +1,5 @@ # Set DB_NAME unless it is already set -export DB_NAME=${DB_NAME:-matrix-demos-${GITHUB_USER}} +export DB_NAME=${DB_NAME:-example-db-${GITHUB_USER}} # Set org name unless it is already set export ORG_NAME=${ORG_NAME:-"planetscale-demo"} From 686dac1c1c20d64c9f3d7c23fc932e4fcacba560 Mon Sep 17 00:00:00 2001 From: Johannes Nicolai Date: Tue, 22 Mar 2022 12:43:11 +0100 Subject: [PATCH 4/4] Don't use planetscale org unless explicitly set --- .../cli-helper-scripts/set-db-and-org-and-branch-name.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.pscale/cli-helper-scripts/set-db-and-org-and-branch-name.sh b/.pscale/cli-helper-scripts/set-db-and-org-and-branch-name.sh index 3f3637a..33a4a57 100755 --- a/.pscale/cli-helper-scripts/set-db-and-org-and-branch-name.sh +++ b/.pscale/cli-helper-scripts/set-db-and-org-and-branch-name.sh @@ -1,17 +1,22 @@ # Set DB_NAME unless it is already set -export DB_NAME=${DB_NAME:-example-db-${GITHUB_USER}} +export DB_NAME=${DB_NAME:-harry-potter-${GITHUB_USER:-db}} echo "Using DB name ${DB_NAME}" # set org name to first org the user has access to unless it is already set in ORG_NAME if [ -z "${ORG_NAME}" ]; then export ORG_NAME=`pscale org list --format json | jq -r ".[0].name"` - # check exit code and name of the org + # check exit code if [ $? -ne 0 ] || [ -z "${ORG_NAME}" ]; then echo "Error: Failed to get PlanetScale org name, please set ORG_NAME explicitly or use Web based SSO, service tokens do not allow to list orgs." exit 1 fi + # if org name is set to planetscale, we will set org name to planetscale-demo instead + if [ "${ORG_NAME}" = "planetscale" ]; then + export ORG_NAME="planetscale-demo" + fi fi + echo "Using org name ${ORG_NAME}" export BRANCH_NAME=${BRANCH_NAME:-"main"}