Skip to content

Commit 32a6378

Browse files
committed
Add update_strategy for envvars and secrets
The default behavior remains to merge (--update), but setting the update_strategy to "overwrite" will set all values.
1 parent 08b62e2 commit 32a6378

9 files changed

Lines changed: 402 additions & 340 deletions

File tree

.github/workflows/integration.yml

Lines changed: 178 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
include:
3131
- name: 'image'
3232
image: 'gcr.io/cloudrun/hello'
33-
- name: 'source'
34-
source: 'example-app'
33+
# - name: 'source'
34+
# source: 'example-app'
3535

3636
name: 'from_${{ matrix.name }}'
3737

@@ -150,179 +150,179 @@ jobs:
150150
}
151151
REVISION_COUNT: 2
152152

153-
metadata:
154-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
155-
runs-on: 'ubuntu-latest'
156-
157-
steps:
158-
- uses: 'actions/checkout@v4'
159-
160-
- name: 'Compute service name'
161-
run: |-
162-
echo "SERVICE_NAME=${GITHUB_JOB}-metadata-${GITHUB_SHA::7}-${GITHUB_RUN_NUMBER}" >> ${GITHUB_ENV}
163-
164-
- name: 'Set service name in metadata YAML'
165-
run: |-
166-
sed -i "s/run-full-yaml/${{ env.SERVICE_NAME }}/" ./tests/fixtures/service.yaml
167-
168-
- uses: 'actions/setup-node@v4'
169-
with:
170-
node-version: '20.x'
171-
172-
- run: 'npm ci && npm run build'
173-
174-
- uses: 'google-github-actions/auth@v2'
175-
with:
176-
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
177-
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
178-
179-
- id: 'deploy-cloudrun'
180-
name: 'Deploy'
181-
uses: './'
182-
with:
183-
metadata: './tests/fixtures/service.yaml'
184-
185-
- name: 'Run initial deploy tests'
186-
run: 'npm run e2e-tests'
187-
env:
188-
PROJECT_ID: '${{ vars.PROJECT_ID }}'
189-
SERVICE: '${{ env.SERVICE_NAME }}'
190-
PARAMS: |-
191-
{
192-
"cpu": "2",
193-
"memory": "1Gi",
194-
"containerConcurrency": "20"
195-
}
196-
ANNOTATIONS: |-
197-
{
198-
"run.googleapis.com/cloudsql-instances": "test-project:us-central1:my-test-instance"
199-
}
200-
LABELS: |-
201-
{
202-
"test_label": "test_value"
203-
}
204-
205-
- id: 'deploy-cloudrun-again'
206-
name: 'Deploy again'
207-
uses: './'
208-
with:
209-
image: 'gcr.io/cloudrun/hello'
210-
service: '${{ env.SERVICE_NAME }}'
211-
212-
- name: 'Run re-deploy tests'
213-
run: 'npm run e2e-tests' # Check that config isn't overwritten
214-
env:
215-
PROJECT_ID: '${{ vars.PROJECT_ID }}'
216-
SERVICE: '${{ env.SERVICE_NAME }}'
217-
PARAMS: |-
218-
{
219-
"cpu": "2",
220-
"memory": "1Gi",
221-
"containerConcurrency": "20"
222-
}
223-
ANNOTATIONS: |-
224-
{
225-
"run.googleapis.com/cloudsql-instances": "test-project:us-central1:my-test-instance"
226-
}
227-
REVISION_COUNT: 2
228-
229-
jobs:
230-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
231-
runs-on: 'ubuntu-latest'
232-
233-
steps:
234-
- uses: 'actions/checkout@v4'
235-
236-
- name: 'Compute job name'
237-
run: |-
238-
echo "JOB_NAME=${GITHUB_JOB}-job-${GITHUB_SHA::7}-${GITHUB_RUN_NUMBER}" >> ${GITHUB_ENV}
239-
240-
- uses: 'actions/setup-node@v4'
241-
with:
242-
node-version: '20.x'
243-
244-
- run: 'npm ci && npm run build'
245-
246-
- uses: 'google-github-actions/auth@v2'
247-
with:
248-
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
249-
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
250-
251-
- id: 'deploy-cloudrun'
252-
name: 'Deploy'
253-
uses: './'
254-
with:
255-
image: 'gcr.io/cloudrun/hello'
256-
job: '${{ env.JOB_NAME }}'
257-
env_vars: |-
258-
FOO=bar
259-
ZIP=zap\,with|separators\,and&stuff
260-
env_vars_file: './tests/fixtures/env_vars.txt'
261-
secrets: |-
262-
MY_SECRET=${{ vars.SECRET_NAME }}:latest
263-
MY_SECOND_SECRET=${{ vars.SECRET_NAME }}:1
264-
labels: |-
265-
label1=value1
266-
label2=value2
267-
skip_default_labels: true
268-
flags: '--cpu=2'
269-
270-
- name: 'Run initial deploy tests'
271-
run: 'npm run e2e-tests'
272-
env:
273-
PROJECT_ID: ${{ vars.PROJECT_ID }}
274-
JOB: '${{ env.JOB_NAME }}'
275-
ENV: |-
276-
{
277-
"FOO": "bar",
278-
"ZIP": "zap,with|separators,and&stuff",
279-
"TEXT_FOO": "bar",
280-
"TEXT_ZIP": "zap,with|separators,and&stuff"
281-
}
282-
SECRET_ENV: |-
283-
{
284-
"MY_SECRET": "${{ vars.SECRET_NAME }}:latest",
285-
"MY_SECOND_SECRET": "${{ vars.SECRET_NAME }}:1"
286-
}
287-
LABELS: |-
288-
{
289-
"label1": "value1",
290-
"label2": "value2"
291-
}
292-
293-
- id: 'deploy-cloudrun-again'
294-
name: 'Deploy again'
295-
uses: './'
296-
with:
297-
image: 'gcr.io/cloudrun/hello'
298-
job: '${{ env.JOB_NAME }}'
299-
env_vars: |-
300-
ABC=123
301-
DEF=456
302-
secrets: /api/secrets/my-secret=${{ vars.SECRET_NAME }}:latest
303-
304-
- name: 'Run re-deploy tests'
305-
run: 'npm run e2e-tests'
306-
env:
307-
PROJECT_ID: ${{ vars.PROJECT_ID }}
308-
JOB: '${{ env.JOB_NAME }}'
309-
ENV: |-
310-
{
311-
"FOO": "bar",
312-
"ZIP": "zap,with|separators,and&stuff",
313-
"TEXT_FOO": "bar",
314-
"TEXT_ZIP": "zap,with|separators,and&stuff",
315-
"ABC": "123",
316-
"DEF": "456"
317-
}
318-
SECRET_VOLUMES: |-
319-
{
320-
"/api/secrets/my-secret": "${{ vars.SECRET_NAME }}:latest"
321-
}
322-
LABELS: |-
323-
{
324-
"label1": "value1",
325-
"label2": "value2",
326-
"commit-sha": "${{ github.sha }}",
327-
"managed-by": "github-actions"
328-
}
153+
# metadata:
154+
# if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
155+
# runs-on: 'ubuntu-latest'
156+
157+
# steps:
158+
# - uses: 'actions/checkout@v4'
159+
160+
# - name: 'Compute service name'
161+
# run: |-
162+
# echo "SERVICE_NAME=${GITHUB_JOB}-metadata-${GITHUB_SHA::7}-${GITHUB_RUN_NUMBER}" >> ${GITHUB_ENV}
163+
164+
# - name: 'Set service name in metadata YAML'
165+
# run: |-
166+
# sed -i "s/run-full-yaml/${{ env.SERVICE_NAME }}/" ./tests/fixtures/service.yaml
167+
168+
# - uses: 'actions/setup-node@v4'
169+
# with:
170+
# node-version: '20.x'
171+
172+
# - run: 'npm ci && npm run build'
173+
174+
# - uses: 'google-github-actions/auth@v2'
175+
# with:
176+
# workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
177+
# service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
178+
179+
# - id: 'deploy-cloudrun'
180+
# name: 'Deploy'
181+
# uses: './'
182+
# with:
183+
# metadata: './tests/fixtures/service.yaml'
184+
185+
# - name: 'Run initial deploy tests'
186+
# run: 'npm run e2e-tests'
187+
# env:
188+
# PROJECT_ID: '${{ vars.PROJECT_ID }}'
189+
# SERVICE: '${{ env.SERVICE_NAME }}'
190+
# PARAMS: |-
191+
# {
192+
# "cpu": "2",
193+
# "memory": "1Gi",
194+
# "containerConcurrency": "20"
195+
# }
196+
# ANNOTATIONS: |-
197+
# {
198+
# "run.googleapis.com/cloudsql-instances": "test-project:us-central1:my-test-instance"
199+
# }
200+
# LABELS: |-
201+
# {
202+
# "test_label": "test_value"
203+
# }
204+
205+
# - id: 'deploy-cloudrun-again'
206+
# name: 'Deploy again'
207+
# uses: './'
208+
# with:
209+
# image: 'gcr.io/cloudrun/hello'
210+
# service: '${{ env.SERVICE_NAME }}'
211+
212+
# - name: 'Run re-deploy tests'
213+
# run: 'npm run e2e-tests' # Check that config isn't overwritten
214+
# env:
215+
# PROJECT_ID: '${{ vars.PROJECT_ID }}'
216+
# SERVICE: '${{ env.SERVICE_NAME }}'
217+
# PARAMS: |-
218+
# {
219+
# "cpu": "2",
220+
# "memory": "1Gi",
221+
# "containerConcurrency": "20"
222+
# }
223+
# ANNOTATIONS: |-
224+
# {
225+
# "run.googleapis.com/cloudsql-instances": "test-project:us-central1:my-test-instance"
226+
# }
227+
# REVISION_COUNT: 2
228+
229+
# jobs:
230+
# if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
231+
# runs-on: 'ubuntu-latest'
232+
233+
# steps:
234+
# - uses: 'actions/checkout@v4'
235+
236+
# - name: 'Compute job name'
237+
# run: |-
238+
# echo "JOB_NAME=${GITHUB_JOB}-job-${GITHUB_SHA::7}-${GITHUB_RUN_NUMBER}" >> ${GITHUB_ENV}
239+
240+
# - uses: 'actions/setup-node@v4'
241+
# with:
242+
# node-version: '20.x'
243+
244+
# - run: 'npm ci && npm run build'
245+
246+
# - uses: 'google-github-actions/auth@v2'
247+
# with:
248+
# workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
249+
# service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
250+
251+
# - id: 'deploy-cloudrun'
252+
# name: 'Deploy'
253+
# uses: './'
254+
# with:
255+
# image: 'gcr.io/cloudrun/hello'
256+
# job: '${{ env.JOB_NAME }}'
257+
# env_vars: |-
258+
# FOO=bar
259+
# ZIP=zap\,with|separators\,and&stuff
260+
# env_vars_file: './tests/fixtures/env_vars.txt'
261+
# secrets: |-
262+
# MY_SECRET=${{ vars.SECRET_NAME }}:latest
263+
# MY_SECOND_SECRET=${{ vars.SECRET_NAME }}:1
264+
# labels: |-
265+
# label1=value1
266+
# label2=value2
267+
# skip_default_labels: true
268+
# flags: '--cpu=2'
269+
270+
# - name: 'Run initial deploy tests'
271+
# run: 'npm run e2e-tests'
272+
# env:
273+
# PROJECT_ID: ${{ vars.PROJECT_ID }}
274+
# JOB: '${{ env.JOB_NAME }}'
275+
# ENV: |-
276+
# {
277+
# "FOO": "bar",
278+
# "ZIP": "zap,with|separators,and&stuff",
279+
# "TEXT_FOO": "bar",
280+
# "TEXT_ZIP": "zap,with|separators,and&stuff"
281+
# }
282+
# SECRET_ENV: |-
283+
# {
284+
# "MY_SECRET": "${{ vars.SECRET_NAME }}:latest",
285+
# "MY_SECOND_SECRET": "${{ vars.SECRET_NAME }}:1"
286+
# }
287+
# LABELS: |-
288+
# {
289+
# "label1": "value1",
290+
# "label2": "value2"
291+
# }
292+
293+
# - id: 'deploy-cloudrun-again'
294+
# name: 'Deploy again'
295+
# uses: './'
296+
# with:
297+
# image: 'gcr.io/cloudrun/hello'
298+
# job: '${{ env.JOB_NAME }}'
299+
# env_vars: |-
300+
# ABC=123
301+
# DEF=456
302+
# secrets: /api/secrets/my-secret=${{ vars.SECRET_NAME }}:latest
303+
304+
# - name: 'Run re-deploy tests'
305+
# run: 'npm run e2e-tests'
306+
# env:
307+
# PROJECT_ID: ${{ vars.PROJECT_ID }}
308+
# JOB: '${{ env.JOB_NAME }}'
309+
# ENV: |-
310+
# {
311+
# "FOO": "bar",
312+
# "ZIP": "zap,with|separators,and&stuff",
313+
# "TEXT_FOO": "bar",
314+
# "TEXT_ZIP": "zap,with|separators,and&stuff",
315+
# "ABC": "123",
316+
# "DEF": "456"
317+
# }
318+
# SECRET_VOLUMES: |-
319+
# {
320+
# "/api/secrets/my-secret": "${{ vars.SECRET_NAME }}:latest"
321+
# }
322+
# LABELS: |-
323+
# {
324+
# "label1": "value1",
325+
# "label2": "value2",
326+
# "commit-sha": "${{ github.sha }}",
327+
# "managed-by": "github-actions"
328+
# }

0 commit comments

Comments
 (0)