forked from rootux/midburnerot-dreams
-
Notifications
You must be signed in to change notification settings - Fork 8
/
continuous_deployment.sh
executable file
·38 lines (29 loc) · 1.27 KB
/
continuous_deployment.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
HELM_UPDATE_COMMIT_MESSAGE="${K8S_ENVIRONMENT_NAME} dreams image update --no-deploy"
RES=0
cd /dreams;
! gcloud container builds submit --substitutions _IMAGE_TAG=${IMAGE_TAG} \
--config continuous_deployment_cloudbuild.yaml \
. \
&& echo 'failed to build dreams image' && RES=1;
cd /ops
! ./helm_update_values.sh "${B64_UPDATE_VALUES}" "${HELM_UPDATE_COMMIT_MESSAGE}" "${K8S_OPS_GITHUB_REPO_TOKEN}" \
"${OPS_REPO_SLUG}" "${OPS_REPO_BRANCH}" \
&& echo 'failed helm update values' && RES=1;
! ./helm_upgrade_external_chart.sh dreams \
&& echo "failed to upgrade dreams chart" && RES=1;
while ! kubectl rollout status deployment dreams --watch=false; do
echo 'waiting for dreams deployment rollout';
for POD in `kubectl get pods | grep dreams- | cut -d" " -f1 -`; do
POD_JSON=`kubectl get -ojson pod $POD`;
POD_STATUS=`echo "${POD_JSON}" | jq -r .status.phase`;
if [ "${POD_STATUS}" != "Running" ]; then
kubectl describe pod $POD;
kubectl logs --tail=100 $POD -c dreams;
# kubectl logs --tail=100 $POD -c migrations;
fi;
done;
echo "sleeping for 60 seconds"
sleep 60;
done;
exit $RES