featurebase/qa/scripts/setupTremorDeleteTest.sh
souhailanoor 2bdf1f5081
FB-1597: unifying idk and featurebase (#2160)
* unifying idk and featurebase: first pass

* resolved conflict with master for gitignore & dockerignore

* deleted binaries that were accidentally pushed to git

* combined gitlab jobs for idk & featurebase

* run go fmt for idk

* updated ssh env variable, and made docker password variable in gitlab env variables

* fixed typo assigning variable name

* trying to fix docker login error

* trying a different solution for docker password

* pass registry

* fixed docker login

* updated paths for idk

* exclude idk tests from featurebase test run

* fix vendor error

* update certificates

* grpc needs to be in version 1.38
genproto, which is imported by big query updates the grpc version to 1.47.0
grpc 1.47.0 causes etcd to deadlock when calling etcd.Close()
the fix is to have a replace in go.mod to specify a specific grpc version

* run go mod tidy

* go mod

* run go mod tidy

* exclude bigquery since it is causing issues and undo grpc replace in go.mod

* fix grpc version

* fix formatting error

* update formatting

* attempt to fix formatting

* update path for code coverage

* update to use current branch binaries, not master

* fix for building idk - path updates

* udpate path for binaries

* update job dependecies

* update docker idk tests to use the current branch registry

* update stages for jobs

* updated job dependencies

* not allow idk s3 dump to fail since it is a dependency for integration tests

* update dependecy for idk tests

* update paths for idk build and code coverage

* download featurebase binary from s3

* pass branch name to all setup scripts

* change to current branch instead of master

* updated sonarcloud

* sonarcloud fix and branch name fix

* trying to speed up pipeline run time

* update stage

* branch name fix + sonar cloud

* sonarcloud
2022-07-28 17:23:16 -05:00

125 lines
No EOL
4.5 KiB
Bash
Executable file

#!/bin/bash
set -e
set +x
# To run script: ./setupTremorDeleteTest.sh $BRANCH_NAME
export TF_IN_AUTOMATION=1
# branch name
BRANCH_NAME=$1
echo "Running tests for branch ${BRANCH_NAME}"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $SCRIPT_DIR/utilCluster.sh
# path for ebs device
EBS_DEVICE_NAME=nvme
# featurebase architecture
FB_BINARY=featurebase_linux_amd64
echo "Downloading FeatureBase binary"
aws s3 cp s3://molecula-artifact-storage/featurebase/${BRANCH_NAME}/_latest/featurebase_linux_amd64 ./ --profile=$TF_VAR_profile
# datagen binary
DATAGEN_BINARY=datagen
echo "Downloading Datagen binary"
aws s3 cp s3://molecula-artifact-storage/idk/${BRANCH_NAME}/_latest/idk-linux-amd64/datagen $DATAGEN_BINARY --profile=$TF_VAR_profile
KAFKA_STATIC=molecula-consumer-kafka-static
echo "Downloading Molecular Consumer Kafka Static binary"
aws s3 cp s3://molecula-artifact-storage/idk/${BRANCH_NAME}/_latest/idk-linux-amd64/molecula-consumer-kafka-static ./$KAFKA_STATIC --profile=$TF_VAR_profile
# get the first ingest host
INGESTNODE0=$(cat ./qa/tf/ci/deletetest/outputs.json | jq -r '[.ingest_ips][0]["value"][0]')
echo "using INGESTNODE0 ${INGESTNODE0}"
# get the first data host
DATANODE0=$(cat ./qa/tf/ci/deletetest/outputs.json | jq -r '[.data_node_ips][0]["value"][0]')
echo "using DATANODE0 ${DATANODE0}"
DEPLOYED_CLUSTER_PREFIX=$(cat ./qa/tf/ci/deletetest/outputs.json | jq -r '[.cluster_prefix][0]["value"]')
echo "Using DEPLOYED_CLUSTER_PREFIX: ${DEPLOYED_CLUSTER_PREFIX}"
DEPLOYED_CLUSTER_REPLICA_COUNT=$(cat ./qa/tf/ci/deletetest/outputs.json | jq -r '[.fb_cluster_replica_count][0]["value"]')
echo "Using DEPLOYED_CLUSTER_REPLICA_COUNT: ${DEPLOYED_CLUSTER_REPLICA_COUNT}"
DEPLOYED_DATA_IPS=($(cat ./qa/tf/ci/deletetest/outputs.json | jq -r '[.data_node_ips][0]["value"][]'))
echo "DEPLOYED_DATA_IPS: {"
echo "${DEPLOYED_DATA_IPS[@]}"
echo "}"
DEPLOYED_DATA_IPS_LEN=${#DEPLOYED_DATA_IPS[@]}
DEPLOYED_INGEST_IPS=($(cat ./qa/tf/ci/deletetest/outputs.json | jq -r '[.ingest_ips][0]["value"][]'))
echo "DEPLOYED_INGEST_IPS: {"
echo "${DEPLOYED_INGEST_IPS[@]}"
echo "}"
DEPLOYED_INGEST_IPS_LEN=${#DEPLOYED_INGEST_IPS[@]}
#wait until we can connect to one of the hosts
for i in {0..24}
do
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o StrictHostKeyChecking=no -o ConnectTimeout=10 ec2-user@${DATANODE0} "pwd"
if [ $? -eq 0 ]
then
echo "Cluster is up after ${i} tries."
break
fi
sleep 10
done
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o StrictHostKeyChecking=no -o ConnectTimeout=10 ec2-user@${DATANODE0} "pwd"
if [ $? -ne 0 ]
then
echo "Unable to connect to cluster - giving up"
exit 1
fi
setupClusterNodes $BRANCH_NAME
rm $FB_BINARY
# verify featurebase running
echo "Verifying featurebase cluster running..."
curl -s http://${DATANODE0}:10101/status
if (( $? != 0 ))
then
echo "Featurebase cluster not running"
exit 1
fi
echo "Cluster running."
# path for ebs device
EBS_DEVICE_NAME=/dev/sdb
# copy datagen to ingest nodes
setupIngestNode1(){
IP=$1
echo "Setting up first ingest node: ${IP}"
scp -i ~/.ssh/gitlab-featurebase-ci.pem -o "StrictHostKeyChecking no" ${DATAGEN_BINARY} ec2-user@${IP}:
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o StrictHostKeyChecking=no ec2-user@${IP} "chmod ugo+x /home/ec2-user/${DATAGEN_BINARY}"
scp -i ~/.ssh/gitlab-featurebase-ci.pem -o "StrictHostKeyChecking no" ./qa/scripts/delete/tremor_keys.yaml ./qa/scripts/delete/kafkaIngest.sh ec2-user@${IP}:
setupKafkaServer ${IP}
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o StrictHostKeyChecking=no ec2-user@${IP} "sudo yum install jq htop tmux -y"
}
setupIngestNode2(){
IP=$1
echo "Setting up second ingest node: ${IP}"
scp -i ~/.ssh/gitlab-featurebase-ci.pem -o "StrictHostKeyChecking no" ./qa/scripts/delete/schema.json ./qa/scripts/delete/featurebaseIngest.sh ec2-user@${IP}:
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o StrictHostKeyChecking=no ec2-user@${IP} "sudo yum install librdkafka -y"
scp -i ~/.ssh/gitlab-featurebase-ci.pem -o "StrictHostKeyChecking no" ${KAFKA_STATIC} ec2-user@${IP}:
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o StrictHostKeyChecking=no ec2-user@${IP} "chmod ugo+x /home/ec2-user/${KAFKA_STATIC}"
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o StrictHostKeyChecking=no ec2-user@${IP} "sudo yum install jq htop tmux nc -y"
}
if [[ $DEPLOYED_INGEST_IPS_LEN -ne "2" ]]; then
echo "error expected 2 ingest nodes, got $DEPLOYED_INGEST_IPS_LEN"
exit 1
fi
setupIngestNode1 ${DEPLOYED_INGEST_IPS[0]}
setupIngestNode2 ${DEPLOYED_INGEST_IPS[1]}