Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a bit of error checking and early exiting to the E2E Setup Script #631

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion test/awsE2ESolutionSetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ read -r -d '' cdk_context << EOM
}
EOM

git clone https://github.com/lewijacn/opensearch-cluster-cdk.git || echo "Repo already exists, skipping.."
if [ ! -d "opensearch-cluster-cdk" ]; then
git clone https://github.com/lewijacn/opensearch-cluster-cdk.git
else
echo "Repo already exists, skipping clone."
fi
cd opensearch-cluster-cdk && git checkout migration-es
git pull
npm install
Expand All @@ -214,6 +218,10 @@ fi
if [ "$SKIP_SOURCE_DEPLOY" = false ] ; then
# Deploy source cluster on EC2 instances
cdk deploy "*" --require-approval never --c suffix="Migration-Source" --c distVersion="7.10.2" --c distributionUrl="https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-7.10.2-linux-x86_64.tar.gz" --c captureProxyEnabled=true --c securityDisabled=true --c minDistribution=false --c cpuArch="x64" --c isInternal=true --c singleNodeCluster=true --c networkAvailabilityZones=2 --c dataNodeCount=1 --c managerNodeCount=0 --c serverAccessType="ipv4" --c restrictServerAccessTo="0.0.0.0/0"
if [ $? -ne 0 ]; then
echo "Error: deploy source cluster failed, exiting."
exit 1
fi
fi

source_endpoint=$(aws cloudformation describe-stacks --stack-name opensearch-infra-stack-Migration-Source --query "Stacks[0].Outputs[?OutputKey==\`loadbalancerurl\`].OutputValue" --output text)
Expand All @@ -232,10 +240,22 @@ if [ "$SKIP_MIGRATION_DEPLOY" = false ] ; then

cd ../../deployment/cdk/opensearch-service-migration || exit
./buildDockerImages.sh
if [ $? -ne 0 ]; then
echo "Error: building docker images failed, exiting."
exit 1
fi
npm install
cdk deploy "*" --c aws-existing-source=$cdk_context --c contextId=aws-existing-source --require-approval never --concurrency 3
if [ $? -ne 0 ]; then
echo "Error: deploying migration stacks failed, exiting."
exit 1
fi
fi

if [ "$SKIP_CAPTURE_PROXY" = false ] ; then
prepare_source_nodes_for_capture "$STAGE"
if [ $? -ne 0 ]; then
echo "Error: enabling capture proxy on source cluster, exiting."
exit 1
fi
fi