From b683220dd62aa90f8bb9db8d937aef4373a895c4 Mon Sep 17 00:00:00 2001 From: abessiari Date: Sun, 15 Oct 2023 20:41:35 -0700 Subject: [PATCH] Check for dns record (#30) * checking for record * checking for record --- provision/github/run.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/provision/github/run.sh b/provision/github/run.sh index 44909fa..4c5f5a2 100755 --- a/provision/github/run.sh +++ b/provision/github/run.sh @@ -2,16 +2,29 @@ ansible --version terraform --version +go_deploy_version=`go-deploy -version` +echo "go_deploy_version=$go_deploy_version" + ls -l /tmp +zone_id=`aws route53 list-hosted-zones-by-name --dns-name geneontology.io. --max-items 1 --query "HostedZones[].Id" --output text | tr "/" " " | awk '{ print $2 }'` +record_name=cicd-test-go-graphstore.geneontology.io +aws route53 list-resource-record-sets --hosted-zone-id $zone_id --max-items 1000 --query "ResourceRecordSets[].Name" | grep $record_name +ret=$? + +if [ "${ret}" == 0 ] +then + echo "$record_name exists. Cannot proceed. Try again later." + exit 1 +fi + +echo "Great. $record_name not found ... Proceeeding" # Prepare TF backend s3_terraform_backend=$S3_TF_BACKEND sed "s/REPLACE_ME_GOGRAPHSTORE_S3_STATE_STORE/$s3_terraform_backend/g" ./github/backend.tf.sample > aws/backend.tf # Prepare config yaml files. -zone_id=`aws route53 list-hosted-zones-by-name --dns-name geneontology.io. --max-items 1 --query "HostedZones[].Id" --output text | tr "/" " " | awk '{ print $2 }'` -record_name=cicd-test-go-graphstore.geneontology.io sed "s/REPLACE_ME_WITH_ZONE_ID/$zone_id/g" ./github/config-instance.yaml.sample > ./github/config-instance.yaml sed -i "s/REPLACE_ME_WITH_RECORD_NAME/$record_name/g" ./github/config-instance.yaml