Skip to content

Commit

Permalink
- Added ec2lm_set_dns_cname() function to EC2LM for more specific DNS…
Browse files Browse the repository at this point in the history
… modifications

- Improved Release Phase deployment script reliability.
  • Loading branch information
gitwater committed Oct 27, 2021
1 parent ab14938 commit 80bc2a2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/paco/application/ec2_launch_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,31 @@ def init_ec2lm_function(self, ec2lm_bucket_name, resource, stack_name):
EOF
aws route53 change-resource-record-sets --hosted-zone-id $HOSTED_ZONE_ID --change-batch file://$RECORD_SET_FILE
}}
# Set EC2 DNS
function ec2lm_set_dns_cname() {{
RECORD_SET_FILE=/tmp/internal_record_set.json
DOMAIN=$1
CNAME_RECORD="$2"
HOSTED_ZONE_ID=$2
cat << EOF >$RECORD_SET_FILE
{{
"Comment": "API Server",
"Changes": [ {{
"Action": "UPSERT",
"ResourceRecordSet": {{
"Name": "$DOMAIN",
"Type": "CNAME",
"TTL": 60,
"ResourceRecords": [ {{
"Value": "$CNAME_RECORD"
}} ]
}}
}} ]
}}
EOF
aws route53 change-resource-record-sets --hosted-zone-id $HOSTED_ZONE_ID --change-batch file://$RECORD_SET_FILE
}}
"""
if resource.secrets != None and len(resource.secrets) > 0:
self.ec2lm_functions_script[ec2lm_bucket_name] += self.add_secrets_function_policy(resource)
Expand Down
6 changes: 6 additions & 0 deletions src/paco/application/reseng_deploymentpipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,12 @@
local TASK_ARN=$2
TAG_QUERY="tags[?key==\`PACO-RELEASE-PHASE\`][value==\`${RELEASE_PHASE_NAME}\`]"
set +e
aws ecs list-tags-for-resource --resource-arn ${TASK_ARN} --query ${TAG_QUERY} --output text
if [ $? -ne 0 ] ; then
echo "False"
fi
set -e
}
# -----------------------------
Expand All @@ -349,6 +354,7 @@
# Check to make sure the task is not already running, if it is, stop it.
local CLUSTER_ID=$1
local RELEASE_PHASE_NAME=$2
echo "${ECHO_PREFIX}: stale_task_check: Checking for stale tasks: $RELEASE_PHASE_NAME"
for TASK_ARN in $(aws ecs list-tasks --cluster ${CLUSTER_ID} --query 'taskArns[*]' --output text)
do
RELEASE_TASK_RUNNING=$(is_release_phase_task ${RELEASE_PHASE_NAME} ${TASK_ARN})
Expand Down

0 comments on commit 80bc2a2

Please sign in to comment.