File tree 2 files changed +33
-2
lines changed
2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ RUN pip3 install --no-cache --upgrade boto3
8
8
9
9
ADD src .
10
10
11
- RUN chmod +x deploy.sh task-deploy.sh run-task.sh tail-task-logs.py
11
+ RUN chmod +x deploy.sh task-deploy.sh run-task.sh cutover.sh tail-task-logs.py
12
12
13
13
ENTRYPOINT [ "/bin/bash" , "-c" ]
14
14
15
- CMD [ "/work/deploy.sh" ]
15
+ CMD [ "/work/deploy.sh" ]
Original file line number Diff line number Diff line change
1
+ #! /bin/bash -e
2
+
3
+ ERROR=0
4
+ if [[ -z " $AWS_DEFAULT_REGION " ]]; then echo " ---> ERROR: Missing variable AWS_DEFAULT_REGION" ; ERROR=1; fi
5
+ if [[ -z " $APP_NAME " ]]; then echo " ---> ERROR: Missing variable APP_NAME" ; ERROR=1; fi
6
+ if [[ -z " $CLUSTER_NAME " ]]; then echo " ---> ERROR: Missing variable CLUSTER_NAME" ; ERROR=1; fi
7
+ if [[ -z " $CONTAINER_PORT " ]]; then echo " ---> ERROR: Missing variable CONTAINER_PORT" ; ERROR=1; fi
8
+ if [[ -z " $IMAGE_NAME " ]]; then echo " ---> ERROR: Missing variable IMAGE_NAME" ; ERROR=1; fi
9
+ if [[ " $ERROR " == " 1" ]]; then exit 1; fi
10
+
11
+ # Fetch deployment ID pending cutover to the green(new) enviroment
12
+ DEPLOYMENT_ID=$( aws deploy list-deployments --application-name=$CLUSTER_NAME -$APP_NAME --deployment-group=$CLUSTER_NAME -$APP_NAME --max-items=1 --query=" deployments[0]" --output=text | head -n 1)
13
+
14
+ DEPLOYMENT_PID=$!
15
+
16
+ # echo "---> For More Deployment info: https://$AWS_DEFAULT_REGION.console.aws.amazon.com/codesuite/codedeploy/deployments/$DEPLOYMENT_ID"
17
+
18
+ # echo "---> Waiting for Deployment ..."
19
+
20
+ aws deploy continue-deployment --deployment-id $DEPLOYMENT_ID --deployment-wait-type " READY_WAIT"
21
+
22
+ wait $DEPLOYMENT_PID
23
+ RET=$?
24
+
25
+ if [ $RET -eq 0 ]; then
26
+ echo " ---> Deployment completed!"
27
+ else
28
+ echo " ---> ERROR: Deployment FAILED!"
29
+ fi
30
+
31
+ exit $RET
You can’t perform that action at this time.
0 commit comments