Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit b0f0c60

Browse files
committed
Deployment status
1 parent b49635d commit b0f0c60

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
name: Installation of build dependencies.
1212
command: |
1313
apt update
14-
apt install -y openssl ant git zip
14+
apt install -y openssl ant git zip jq
1515
mkdir ~/awscli
1616
cd ~/awscli
1717
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"

deploy.sh

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
23
ENV=$1
34
APPVER=$2
45

@@ -8,6 +9,9 @@ then
89
exit 1
910
fi
1011

12+
JQ="jq --raw-output --exit-status"
13+
COUNTER_LIMIT=20
14+
1115
BUILD_VARIABLE_FILE_NAME="./buildvar.conf"
1216
source $BUILD_VARIABLE_FILE_NAME
1317

@@ -90,14 +94,30 @@ update_cd_app_revision()
9094
#Invoke the code deploy
9195
cd_deploy()
9296
{
93-
DEPLOYID=`aws deploy create-deployment --application-name "${AWS_CD_APPNAME}" --deployment-config-name "${AWS_CD_DG_CONFIGURATION}" --deployment-group-name "${AWS_CD_DG_NAME}" --s3-location "bucket=${AWS_S3_BUCKET},bundleType=zip,key=${AWS_S3_KEY}"`
97+
RESULT=`aws deploy create-deployment --application-name "${AWS_CD_APPNAME}" --deployment-config-name "${AWS_CD_DG_CONFIGURATION}" --deployment-group-name "${AWS_CD_DG_NAME}" --s3-location "bucket=${AWS_S3_BUCKET},bundleType=zip,key=${AWS_S3_KEY}"`
9498
track_error $? "CD applicaton deployment intiation"
99+
DEPLOYID=`echo $RESULT | $JQ .deploymentId`
95100
log "CD application deployment initiation completed successfully. Please find the $DEPLOYID"
96101
}
97102
#Checing the status
98103
cd_deploy_status()
99104
{
100-
echo "check statusget info aws deploy get-deployment --deployment-id d-USUAELQEX"
105+
echo "check tatusget info aws deploy get-deployment --deployment-id $DEPLOYID"
106+
counter=0
107+
DEPLOYMENT_STATUS=`aws deploy get-deployment --deployment-id "$DEPLOYID" | $JQ .deploymentInfo.status`
108+
while [[ $DEPLOYMENT_STATUS != "Succeeded" ]] || [[ $DEPLOYMENT_STATUS != "Failed" ]]
109+
do
110+
echo "Current Deployment status : $DEPLOYMENT_STATUS"
111+
echo "Waiting for 15 sec to check the Deployment status...."
112+
sleep 15
113+
DEPLOYMENT_STATUS=`aws deploy get-deployment --deployment-id "$DEPLOYID" | $JQ .deploymentInfo.status`
114+
counter=`expr $counter + 1`
115+
if [[ $counter -gt $COUNTER_LIMIT ]] ; then
116+
echo "Deployment does not reach staedy state with in 600 seconds. Please check"
117+
exit 1
118+
fi
119+
done
120+
echo "Deployment status is $DEPLOYMENT_STATUS"
101121

102122
}
103123
configure_aws_cli
@@ -111,6 +131,6 @@ else
111131
exit 0
112132
fi
113133
cd_deploy
114-
#cd_deploy_status
134+
cd_deploy_status
115135

116136

0 commit comments

Comments
 (0)