Skip to content

Commit 05c397e

Browse files
committed
Add persistence
1 parent 78301b8 commit 05c397e

File tree

1 file changed

+85
-4
lines changed

1 file changed

+85
-4
lines changed

.github/workflows/deployment.yml

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
description: 'WebPort for the running instance'
1616
type: number
1717
default: 52773
18+
persistence:
19+
description: 'Set to true to persist your data.'
20+
required: false
21+
type: boolean
22+
default: false
1823
secrets:
1924
SERVICE_ACCOUNT_KEY:
2025
required: true
@@ -60,6 +65,7 @@ jobs:
6065
# if: github.event.repository.fork == false && github.event.repository.is_template == false
6166
name: Deploy to Cloud Run
6267
runs-on: ubuntu-22.04
68+
if: ${{ ! inputs.persistence }}
6369
steps:
6470
- name: Checkout
6571
uses: actions/checkout@v4
@@ -68,21 +74,21 @@ jobs:
6874
ref: ${{ inputs.ref }}
6975

7076
- name: Google Authentication
71-
uses: google-github-actions/[email protected].7
77+
uses: google-github-actions/[email protected].11
7278
with:
7379
credentials_json: ${{ secrets.SERVICE_ACCOUNT_KEY }}
7480

7581
- name: Get GKE credentials
76-
uses: google-github-actions/[email protected].0
82+
uses: google-github-actions/[email protected].4
7783
with:
7884
project_id: ${{ env.PROJECT_ID }}
7985
cluster_name: ${{ env.CLUSTER_NAME }}
8086
location: ${{ env.REGION }}
8187

8288
- name: Setup gcloud cli
83-
uses: google-github-actions/[email protected].2
89+
uses: google-github-actions/[email protected].5
8490
with:
85-
version: '504.0.0'
91+
version: '512.0.0'
8692

8793
- name: Authorize Docker push
8894
run: |
@@ -146,3 +152,78 @@ jobs:
146152
run: |
147153
kubectl version
148154
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 ingress.name=${{ inputs.name }} \
211+
--set ingress.domain=${DOMAIN_NAME} \
212+
--wait \
213+
--atomic \
214+
--timeout 15m
215+
216+
# # echo "[INFO] Deploy service..."
217+
# # gcloud run deploy ${SERVICE} \
218+
# # --platform gke \
219+
# # --cluster ${CLUSTER_NAME} \
220+
# # --cluster-location ${REGION} \
221+
# # --namespace ${NAMESPACE} \
222+
# # --port ${SERVICE_PORT:-52773} \
223+
# # --min-instances 1 \
224+
# # --memory ${SERVICE_MEMORY:-512Mi} \
225+
# # --timeout 300 \
226+
# # --verbosity info \
227+
# # --set-env-vars GITHUB_REPO=${GITHUB_REPO}${CUSTOM_VARS_LIST_ESCAPED:+,${CUSTOM_VARS_LIST_ESCAPED}} \
228+
# # --image ${REGION}-docker.pkg.dev/${PROJECT_ID}/community/${IMAGE_NAME}:${GITHUB_SHA}
229+

0 commit comments

Comments
 (0)