File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed
Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 2020 runs-on : ubuntu-latest
2121 environment : ${{ inputs.environment }}
2222 env :
23+ APPLICATION_STARTUP_MESSAGE : " Application startup complete"
2324 KUBELOGIN_VERSION : " v0.0.25"
2425 KUBERNETES_CLUSTER_REPO_NAME : " ${{ vars.KUBERNETES_CLUSTER_REPO_NAME }}"
2526 KUBERNETES_CLUSTER_NAME : " ${{ vars.KUBERNETES_CLUSTER_NAME }}"
3738 repository : ${{ github.repository_owner }}/${{ env.KUBERNETES_CLUSTER_REPO_NAME }}
3839 ref : refs/heads/dev
3940
41+ - name : GitHub Configuration
42+ run : git config --global url."https://oauth2:${{ secrets.TOKEN_GITHUB }}@github.com".insteadOf https://github.com
43+
44+ - name : Clone cicd-deployment-scripts
45+ run : git clone https://github.com/code-kern-ai/cicd-deployment-scripts.git
46+
4047 # Install the latest version of Kubernetes CLI and configure the Kubernetes CLI configuration file with a Kubernetes Cloud user API token
4148 - name : Azure Cloud Login
4249 uses : Azure/login@v2
@@ -72,11 +79,19 @@ jobs:
7279 with :
7380 namespace : ${{ env.KUBERNETES_NAMESPACE }}
7481 manifests : apply.yml
75- pull-images : false
82+ pull-images : true
7683 images : ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ env.IMAGE_TAG }}
7784 strategy : canary
7885 action : deploy
7986 percentage : 20
87+
88+ - name : Assert Deployment Success
89+ shell : bash
90+ run : |
91+ bash cicd-deployment-scripts/k8s/assert_deploy_success.sh \
92+ -n ${{ env.KUBERNETES_NAMESPACE }} \
93+ -d ${{ github.event.repository.name }} \
94+ -m ${{ env.APPLICATION_STARTUP_MESSAGE }}
8095
8196 - name : Promote Deployment
8297 uses : Azure/k8s-deploy@v5
Original file line number Diff line number Diff line change 1+ # !/bin/bash
2+ set -e
3+
4+ KUBERNETES_NAMESPACE=" "
5+ KUBERNETES_DEPLOYMENT_NAME=" "
6+ APPLICATION_STARTUP_MESSAGE=" Application startup complete"
7+
8+ while getopts n:d:m: flag
9+ do
10+ case " ${flag} " in
11+ n) KUBERNETES_NAMESPACE=${OPTARG} ;;
12+ d) KUBERNETES_DEPLOYMENT_NAME=${OPTARG} ;;
13+ m) APPLICATION_STARTUP_MESSAGE=${OPTARG} ;;
14+ esac
15+ done
16+
17+ kubectl config set-context --current --namespace=$KUBERNETES_NAMESPACE
18+ echo " Context set to namespace: \" $KUBERNETES_NAMESPACE \" "
19+
20+ echo " Reading logs to determine application startup status for '$KUBERNETES_DEPLOYMENT_NAME '"
21+ echo " Searching for message: '$APPLICATION_STARTUP_MESSAGE '"
22+
23+ LOG_CONTENTS=$( kubectl logs deployment/${KUBERNETES_DEPLOYMENT_NAME} \
24+ --container ${KUBERNETES_DEPLOYMENT_NAME} || echo " Waiting for application startuop ..." )
25+
26+ while [[ " $LOG_CONTENTS " != * " $APPLICATION_STARTUP_MESSAGE " * ]]; do
27+ echo " Waiting for application startup..."
28+ sleep 3
29+ LOG_CONTENTS=$( kubectl logs deployment/${KUBERNETES_DEPLOYMENT_NAME} --head=100)
30+ done
You can’t perform that action at this time.
0 commit comments