@@ -53,91 +53,12 @@ jobs:
53
53
build-args : platform=linux/amd64
54
54
55
55
k8-deploy :
56
- name : ' K8: Deploy'
57
- runs-on : ubuntu-latest
56
+ uses : code-kern-ai/cicd-deployment-scripts/.github/workflows/_k8s_deploy.yml@dev
58
57
needs : [az-acr-push]
59
- environment : ${{ github.event_name == 'release' && 'prod' || 'dev' }}
60
- env :
61
- KUBELOGIN_VERSION : " v0.0.25"
62
- KUBERNETES_CLUSTER_REPO_NAME : " ${{ vars.KUBERNETES_CLUSTER_REPO_NAME }}"
63
- KUBERNETES_CLUSTER_NAME : " ${{ vars.KUBERNETES_CLUSTER_NAME }}"
64
- KUBERNETES_NAMESPACE : " ${{ vars.KUBERNETES_NAMESPACE }}"
65
- KUBERNETES_MANIFEST_PATH : " ${{ vars.KUBERNETES_MANIFEST_PATH }}"
66
- AZURE_RESOURCE_GROUP : " ${{ vars.AZURE_RESOURCE_GROUP }}"
67
- AZURE_CONTAINER_REGISTRY : " ${{ vars.AZURE_CONTAINER_REGISTRY }}"
68
- IMAGE_TAG : ${{ github.event_name == 'release' && github.event.release.tag_name || 'amd64' }}
69
- steps :
70
- # Checkout the repository to the GitHub Actions runner
71
- - name : Checkout
72
- uses : actions/checkout@v4
73
- with :
74
- token : ${{ secrets.TOKEN_GITHUB }}
75
- repository : ${{ github.repository_owner }}/${{ env.KUBERNETES_CLUSTER_REPO_NAME }}
76
- ref : refs/heads/dev
77
-
78
- # Install the latest version of Kubernetes CLI and configure the Kubernetes CLI configuration file with a Kubernetes Cloud user API token
79
- - name : Azure Cloud Login
80
- uses : Azure/login@v2
81
- with :
82
- client-id : ${{ secrets.AZURE_CLIENT_ID }}
83
- tenant-id : ${{ secrets.AZURE_TENANT_ID }}
84
- subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
85
-
86
- # Use kubelogin to configure your kubeconfig for Azure auth
87
- - name : Set up kubelogin for non-interactive login
88
- uses : azure/use-kubelogin@v1
89
- with :
90
- kubelogin-version : ${{ env.KUBELOGIN_VERSION }}
91
-
92
- - uses : azure/aks-set-context@v3
93
- with :
94
- resource-group : ${{ env.AZURE_RESOURCE_GROUP }}
95
- cluster-name : ${{ env.KUBERNETES_CLUSTER_NAME }}
96
- admin : ' false'
97
- use-kubelogin : ' true'
98
-
99
- - name : Generate Kustomization
100
- shell : bash
101
- env :
102
- KUBECTL_EXTERNAL_DIFF : " colordiff -N -u"
103
- run : |
104
- kubectl kustomize ${{ env.KUBERNETES_MANIFEST_PATH }} --output apply.yml
105
- kubectl diff --filename apply.yml || true
106
-
107
- - name : Generate Deployment
108
- uses : Azure/k8s-deploy@v5
109
- timeout-minutes : 10
110
- with :
111
- namespace : ${{ env.KUBERNETES_NAMESPACE }}
112
- manifests : apply.yml
113
- pull-images : false
114
- images : ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ env.IMAGE_TAG }}
115
- strategy : canary
116
- action : deploy
117
- percentage : 20
118
-
119
- - name : Promote Deployment
120
- uses : Azure/k8s-deploy@v5
121
- if : success()
122
- with :
123
- namespace : ${{ env.KUBERNETES_NAMESPACE }}
124
- manifests : apply.yml
125
- pull-images : false
126
- images : ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ env.IMAGE_TAG }}
127
- strategy : canary
128
- action : promote
129
-
130
- - name : Reject Deployment
131
- uses : Azure/k8s-deploy@v5
132
- if : failure() || cancelled()
133
- with :
134
- namespace : ${{ env.KUBERNETES_NAMESPACE }}
135
- manifests : apply.yml
136
- pull-images : false
137
- images : ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ env.IMAGE_TAG }}
138
- strategy : canary
139
- action : reject
140
-
58
+ secrets : inherit
59
+ with :
60
+ environment : ${{ github.event_name == 'release' && 'prod' || 'dev' }}
61
+
141
62
gh-release-publish :
142
63
name : ' GitHub: Publish Release'
143
64
runs-on : ubuntu-latest
0 commit comments