From 10a61f582133fc540c5ec72229c00bc4383a5d1b Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Fri, 5 Jan 2024 13:07:38 +0100 Subject: [PATCH 1/2] chore: treat null json value as missing key, recreate deployments then --- .buildkite/scripts/steps/cloud/build_and_deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/scripts/steps/cloud/build_and_deploy.sh b/.buildkite/scripts/steps/cloud/build_and_deploy.sh index b6c2dcd0968e3..62f92b716b651 100755 --- a/.buildkite/scripts/steps/cloud/build_and_deploy.sh +++ b/.buildkite/scripts/steps/cloud/build_and_deploy.sh @@ -62,7 +62,7 @@ fi echo "--- Create Deployment" CLOUD_DEPLOYMENT_ID=$(ecctl deployment list --output json | jq -r '.deployments[] | select(.name == "'$CLOUD_DEPLOYMENT_NAME'") | .id') -if [ -z "${CLOUD_DEPLOYMENT_ID}" ]; then +if [ -z "${CLOUD_DEPLOYMENT_ID}" ] || [ "${CLOUD_DEPLOYMENT_ID}" = 'null' ]; then jq ' .resources.kibana[0].plan.kibana.docker_image = "'$KIBANA_CLOUD_IMAGE'" | .resources.elasticsearch[0].plan.elasticsearch.docker_image = "'$ELASTICSEARCH_CLOUD_IMAGE'" | From 1bcf21cfc4aaec6b81af164e2f0049a1276d2b79 Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Fri, 5 Jan 2024 13:09:12 +0100 Subject: [PATCH 2/2] chore: fail if there's no project id right after creation --- .buildkite/scripts/steps/serverless/build_and_deploy.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.buildkite/scripts/steps/serverless/build_and_deploy.sh b/.buildkite/scripts/steps/serverless/build_and_deploy.sh index a78252e3baec0..3e69f4b4878b7 100644 --- a/.buildkite/scripts/steps/serverless/build_and_deploy.sh +++ b/.buildkite/scripts/steps/serverless/build_and_deploy.sh @@ -59,6 +59,11 @@ deploy() { -XPOST -d "$PROJECT_CREATE_CONFIGURATION" &>> $DEPLOY_LOGS PROJECT_ID=$(jq -r --slurp '.[1].id' $DEPLOY_LOGS) + if [ -z "${PROJECT_ID}" ] || [ "$PROJECT_ID" = 'null' ]; then + echo "Failed to create project. Deploy logs:" + cat $DEPLOY_LOGS + exit 1 + fi echo "Get credentials..." curl -s -XPOST -H "Authorization: ApiKey $PROJECT_API_KEY" \