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