Skip to content

Commit 78301b8

Browse files
authored
Merge pull request #3 from intersystems-community/add-custom-env-vars
2 parents f3f0afe + b1d9349 commit 78301b8

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.github/workflows/deployment.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ on:
1818
secrets:
1919
SERVICE_ACCOUNT_KEY:
2020
required: true
21+
CUSTOM_VARS_LIST:
22+
required: false
2123
workflow_dispatch:
2224
inputs:
2325
repository:
@@ -90,11 +92,16 @@ jobs:
9092
run: |
9193
docker buildx build -t ${REGION}-docker.pkg.dev/${PROJECT_ID}/community/${IMAGE_NAME}:${GITHUB_SHA} --push .
9294
95+
# Setting verbosity to debug leads to printing custom variables in the pipeline logs.
96+
# It might be possible to replace 'set-env-vars' to 'set-secrets' but it requires additional Service Account permissions.
9397
- name: Deploy to Cloud Run
9498
run: |
9599
echo "[INFO] Set google project..."
96100
gcloud config set project ${PROJECT_ID}
97101
102+
echo "[INFO] Escaping custom variables..."
103+
export CUSTOM_VARS_LIST_ESCAPED=$(echo "${{ secrets.CUSTOM_VARS_LIST }}" | sed -E 's/"/\\"/g')
104+
98105
echo "[INFO] Deploy service..."
99106
gcloud run deploy ${SERVICE} \
100107
--platform gke \
@@ -105,8 +112,8 @@ jobs:
105112
--min-instances 1 \
106113
--memory ${SERVICE_MEMORY:-512Mi} \
107114
--timeout 300 \
108-
--verbosity debug \
109-
--set-env-vars GITHUB_REPO=${GITHUB_REPO} \
115+
--verbosity info \
116+
--set-env-vars GITHUB_REPO=${GITHUB_REPO}${CUSTOM_VARS_LIST_ESCAPED:+,${CUSTOM_VARS_LIST_ESCAPED}} \
110117
--image ${REGION}-docker.pkg.dev/${PROJECT_ID}/community/${IMAGE_NAME}:${GITHUB_SHA}
111118
112119
echo "[INFO] Create domain mappings..."

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ jobs:
2121
uses: intersystems-community/demo-deployment/.github/workflows/deployment.yml@master
2222
with:
2323
name: <name-of-demo>
24+
## Optional
25+
# memory: 1Gi
26+
# port: 8081
2427
secrets:
2528
SERVICE_ACCOUNT_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }}
29+
## Optional
30+
# CUSTOM_VARS_LIST: "var1=${{ secrets.CUSTOM_VAR1 }},var2=value2,..."
2631
```

0 commit comments

Comments
 (0)