Skip to content

Commit

Permalink
Check for dns record (#30)
Browse files Browse the repository at this point in the history
* checking for record

* checking for record
  • Loading branch information
abessiari authored Oct 16, 2023
1 parent 95eed50 commit b683220
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions provision/github/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b683220

Please sign in to comment.