10
10
memory :
11
11
description : ' Memory for the instance'
12
12
type : string
13
- default : 512Mi
13
+ default : 1Gi
14
14
port :
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,93 @@ 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
+ - name : Prepare Helm Environment Variables
193
+ id : prepare_helm_vars
194
+ run : |
195
+ echo "[INFO] Escaping custom variables..."
196
+ export CUSTOM_VARS_LIST_ESCAPED=$(echo "${{ secrets.CUSTOM_VARS_LIST }}" | sed -E 's/"/\\"/g')
197
+
198
+ if [[ -n "$CUSTOM_VARS_LIST_ESCAPED" ]]; then
199
+ echo "[INFO] CUSTOM_VARS_LIST_ESCAPED contains data. Parsing key-values..."
200
+ IFS=',' read -r -a ENV_PAIRS <<< "$CUSTOM_VARS_LIST_ESCAPED"
201
+
202
+ HELM_ARGS_ARRAY=()
203
+ INDEX=1
204
+ for PAIR in "${ENV_PAIRS[@]}"; do
205
+ # Split each pair into KEY and VALUE at the first '='
206
+ KEY="${PAIR%%=*}"
207
+ VALUE="${PAIR#*=}"
208
+ echo "[INFO] Setting key ${KEY}..."
209
+
210
+ HELM_ARGS_ARRAY+=(--set "extraEnv[$INDEX].name=$KEY,extraEnv[$INDEX].value=$VALUE")
211
+ ((INDEX++))
212
+ done
213
+ fi
214
+
215
+ # The HELM_ARGS_ARRAY is now ready to be used.
216
+ # We can't pass arrays between steps, so we output the array
217
+ # as a single, space-separated string for the next step to use.
218
+ echo "helm_args=${HELM_ARGS_ARRAY[*]}" >> $GITHUB_OUTPUT
219
+
220
+ - name : Deploy Stateful Workload
221
+ run : |
222
+ echo "[INFO] Set google project..."
223
+ gcloud config set project ${PROJECT_ID}
224
+
225
+ echo "[INFO] Escaping custom variables..."
226
+ export CUSTOM_VARS_LIST_ESCAPED=$(echo "${{ secrets.CUSTOM_VARS_LIST }}" | sed -E 's/"/\\"/g')
227
+
228
+ echo "[INFO] Installing IRIS Helm charts repository..."
229
+ helm repo add intersystems-charts https://charts.demo.community.intersystems.com
230
+
231
+ echo "[INFO] Deploy Helm release..."
232
+ helm -n ${NAMESPACE} upgrade --install ${{ inputs.name }} intersystems-charts/iris-app \
233
+ --version 0.0.1 \
234
+ --set image.repository=${REGION}-docker.pkg.dev/${PROJECT_ID}/community/${IMAGE_NAME} \
235
+ --set image.tag=${GITHUB_SHA} \
236
+ --set resources.limits.memory=${SERVICE_MEMORY:-1Gi} \
237
+ --set service.webPort=${SERVICE_PORT:-52773} \
238
+ --set ingress.name=${{ inputs.name }} \
239
+ --set ingress.domain=${DOMAIN_NAME} \
240
+ --set extraEnv[0].name=ISC_DATA_DIRECTORY,extraEnv[0].value=/isc/data \
241
+ ${{ steps.prepare_helm_vars.outputs.helm_args }} \
242
+ --wait \
243
+ --atomic \
244
+ --timeout 10m
0 commit comments