15
15
description : ' WebPort for the running instance'
16
16
type : number
17
17
default : 52773
18
+ persistence :
19
+ description : ' Set to true to persist your data.'
20
+ required : false
21
+ type : boolean
22
+ default : false
18
23
secrets :
19
24
SERVICE_ACCOUNT_KEY :
20
25
required : true
60
65
# if: github.event.repository.fork == false && github.event.repository.is_template == false
61
66
name : Deploy to Cloud Run
62
67
runs-on : ubuntu-22.04
68
+ if : ${{ ! inputs.persistence }}
63
69
steps :
64
70
- name : Checkout
65
71
uses : actions/checkout@v4
@@ -68,21 +74,21 @@ jobs:
68
74
ref : ${{ inputs.ref }}
69
75
70
76
- name : Google Authentication
71
- uses :
google-github-actions/[email protected] .7
77
+ uses :
google-github-actions/[email protected] .11
72
78
with :
73
79
credentials_json : ${{ secrets.SERVICE_ACCOUNT_KEY }}
74
80
75
81
- name : Get GKE credentials
76
- uses :
google-github-actions/[email protected] .0
82
+ uses :
google-github-actions/[email protected] .4
77
83
with :
78
84
project_id : ${{ env.PROJECT_ID }}
79
85
cluster_name : ${{ env.CLUSTER_NAME }}
80
86
location : ${{ env.REGION }}
81
87
82
88
- name : Setup gcloud cli
83
- uses :
google-github-actions/[email protected] .2
89
+ uses :
google-github-actions/[email protected] .5
84
90
with :
85
- version : ' 504 .0.0'
91
+ version : ' 512 .0.0'
86
92
87
93
- name : Authorize Docker push
88
94
run : |
@@ -146,3 +152,74 @@ jobs:
146
152
run : |
147
153
kubectl version
148
154
kubectl patch configmap config-domainmapping -n knative-serving -p '{"data":{"autoTLS":"Enabled"}}'
155
+
156
+ deploy-stateful-workload :
157
+ name : Deploy Stateful Workload
158
+ runs-on : ubuntu-22.04
159
+ if : ${{ inputs.persistence }}
160
+ steps :
161
+ - name : Checkout
162
+ uses : actions/checkout@v4
163
+ with :
164
+ repository : ${{ inputs.repository }}
165
+ ref : ${{ inputs.ref }}
166
+
167
+ - name : Google Authentication
168
+ uses :
google-github-actions/[email protected]
169
+ with :
170
+ credentials_json : ${{ secrets.SERVICE_ACCOUNT_KEY }}
171
+
172
+ - name : Get GKE credentials
173
+ uses :
google-github-actions/[email protected]
174
+ with :
175
+ project_id : ${{ env.PROJECT_ID }}
176
+ cluster_name : ${{ env.CLUSTER_NAME }}
177
+ location : ${{ env.REGION }}
178
+
179
+ - name : Setup gcloud cli
180
+ uses :
google-github-actions/[email protected]
181
+ with :
182
+ version : ' 512.0.0'
183
+
184
+ - name : Authorize Docker push
185
+ run : |
186
+ gcloud --quiet auth configure-docker ${REGION}-docker.pkg.dev
187
+
188
+ - name : Build and Push image
189
+ run : |
190
+ docker buildx build -t ${REGION}-docker.pkg.dev/${PROJECT_ID}/community/${IMAGE_NAME}:${GITHUB_SHA} --push .
191
+
192
+ # Setting verbosity to debug leads to printing custom variables in the pipeline logs.
193
+ # It might be possible to replace 'set-env-vars' to 'set-secrets' but it requires additional Service Account permissions.
194
+ - name : Deploy Stateful Workload
195
+ run : |
196
+ echo "[INFO] Set google project..."
197
+ gcloud config set project ${PROJECT_ID}
198
+
199
+ echo "[INFO] Escaping custom variables..."
200
+ export CUSTOM_VARS_LIST_ESCAPED=$(echo "${{ secrets.CUSTOM_VARS_LIST }}" | sed -E 's/"/\\"/g')
201
+
202
+ echo "[INFO] Installing IRIS Helm charts repository..."
203
+ helm repo add intersystems-charts https://charts.demo.community.intersystems.com
204
+
205
+ echo "[INFO] Deploy Helm release..."
206
+ helm -n ${NAMESPACE} upgrade --install ${{ inputs.name }} intersystems-charts/iris-app \
207
+ --version 0.0.1 \
208
+ --set image.repository=${REGION}-docker.pkg.dev/${PROJECT_ID}/community/${IMAGE_NAME} \
209
+ --set image.tag=${GITHUB_SHA} \
210
+ --set resources.limits.memory=${SERVICE_MEMORY:-1Gi} \
211
+ --set service.webPort=${SERVICE_PORT:-52773} \
212
+ --set ingress.name=${{ inputs.name }} \
213
+ --set ingress.domain=${DOMAIN_NAME} \
214
+ --wait \
215
+ --atomic \
216
+ --timeout 15m
217
+
218
+ # # echo "[INFO] Deploy service..."
219
+ # # gcloud run deploy ${SERVICE} \
220
+ # # --memory ${SERVICE_MEMORY:-512Mi} \
221
+ # # --timeout 300 \
222
+ # # --verbosity info \
223
+ # # --set-env-vars GITHUB_REPO=${GITHUB_REPO}${CUSTOM_VARS_LIST_ESCAPED:+,${CUSTOM_VARS_LIST_ESCAPED}} \
224
+ # # --image ${REGION}-docker.pkg.dev/${PROJECT_ID}/community/${IMAGE_NAME}:${GITHUB_SHA}
225
+
0 commit comments