Skip to content

Commit b628bbf

Browse files
committed
Switch to gen2 API
1 parent 6282b54 commit b628bbf

File tree

16 files changed

+2029
-1290
lines changed

16 files changed

+2029
-1290
lines changed

.github/workflows/cleanup.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ jobs:
1414
runs-on: 'ubuntu-latest'
1515

1616
steps:
17-
- uses: 'actions/checkout@v4'
18-
19-
- uses: 'google-github-actions/auth@v2'
20-
with:
21-
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
22-
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
23-
24-
- uses: 'google-github-actions/setup-gcloud@v2'
25-
26-
- name: Delete services
27-
run: |-
28-
gcloud config set core/project "${{ vars.PROJECT_ID }}"
29-
gcloud config set functions/region "us-central1"
30-
31-
# List and delete all functions that were deployed 30 minutes ago or
32-
# earlier. The date math here is a little weird, but we're looking for
33-
# deployments "earlier than" 30 minutes ago, so it's less than since
34-
# time increases.
35-
(IFS=$'\n'; for NAME in $(gcloud functions list --format="value(name)" --filter="updateTime < '-pt30m'"); do
36-
echo "Deleting ${NAME}..."
37-
gcloud functions delete ${NAME} --quiet
38-
done)
17+
- uses: 'actions/checkout@v4'
18+
19+
- uses: 'google-github-actions/auth@v2'
20+
with:
21+
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
22+
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
23+
24+
- uses: 'google-github-actions/setup-gcloud@v2'
25+
26+
- name: Delete services
27+
run: |-
28+
gcloud config set core/project "${{ vars.PROJECT_ID }}"
29+
gcloud config set functions/region "us-central1"
30+
31+
# List and delete all functions that were deployed 30 minutes ago or
32+
# earlier. The date math here is a little weird, but we're looking for
33+
# deployments "earlier than" 30 minutes ago, so it's less than since
34+
# time increases.
35+
(IFS=$'\n'; for NAME in $(gcloud functions list --format="value(name)" --filter="updateTime < '-pt30m'"); do
36+
echo "Deleting ${NAME}..."
37+
gcloud functions delete ${NAME} --quiet
38+
done)

.github/workflows/draft-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
version_strategy: '${{ github.event.inputs.version_strategy }}'
2222
# secrets must be explicitly passed to reusable workflows https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/reusing-workflows#using-inputs-and-secrets-in-a-reusable-workflow
2323
secrets:
24-
ACTIONS_BOT_TOKEN: '${{ secrets.ACTIONS_BOT_TOKEN }}'
24+
ACTIONS_BOT_TOKEN: '${{ secrets.ACTIONS_BOT_TOKEN }}'

.github/workflows/integration.yml

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,74 +17,73 @@ concurrency:
1717

1818
jobs:
1919
https_trigger:
20-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
20+
timeout-minutes: 10
2121
permissions:
2222
contents: 'read'
2323
id-token: 'write'
2424
runs-on: 'ubuntu-latest'
2525
steps:
26-
- uses: 'actions/checkout@v4'
26+
- uses: 'actions/checkout@v4'
2727

28-
- uses: 'actions/setup-node@v4'
29-
with:
30-
node-version: '20.x'
28+
- uses: 'actions/setup-node@v4'
29+
with:
30+
node-version: '20.x'
3131

32-
- name: 'npm build'
33-
run: 'npm ci && npm run build'
32+
- name: 'npm build'
33+
run: 'npm ci && npm run build'
3434

35-
- uses: 'google-github-actions/auth@v2'
36-
with:
37-
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
38-
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
35+
- uses: 'google-github-actions/auth@v2'
36+
with:
37+
project_id: '${{ vars.PROJECT_ID }}'
38+
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
3939

40-
- id: 'deploy'
41-
uses: './'
42-
with:
43-
name: 'https-trigger-${{ github.run_number }}'
44-
runtime: 'nodejs16'
45-
entry_point: 'helloWorld'
46-
source_dir: './tests/test-node-func/'
47-
https_trigger_security_level: 'secure_always'
40+
- id: 'deploy'
41+
uses: './'
42+
with:
43+
name: 'https-trigger-${{ github.run_number }}'
44+
runtime: 'nodejs22'
45+
entry_point: 'helloWorld'
46+
source_dir: './tests/test-node-func/'
47+
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
4848

4949
event_trigger:
50-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
50+
timeout-minutes: 10
5151
permissions:
5252
contents: 'read'
5353
id-token: 'write'
5454
runs-on: 'ubuntu-latest'
5555
steps:
56-
- uses: 'actions/checkout@v4'
56+
- uses: 'actions/checkout@v4'
5757

58-
- uses: 'actions/setup-node@v4'
59-
with:
60-
node-version: '20.x'
58+
- uses: 'actions/setup-node@v4'
59+
with:
60+
node-version: '20.x'
6161

62-
- name: 'npm build'
63-
run: 'npm ci && npm run build'
62+
- name: 'npm build'
63+
run: 'npm ci && npm run build'
6464

65-
- uses: 'google-github-actions/auth@v2'
66-
with:
67-
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
68-
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
65+
- uses: 'google-github-actions/auth@v2'
66+
with:
67+
project_id: '${{ vars.PROJECT_ID }}'
68+
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
6969

70-
- id: 'deploy'
71-
uses: './'
72-
with:
73-
name: 'event-trigger-${{ github.run_number }}'
74-
runtime: 'nodejs16'
75-
entry_point: 'helloWorld'
76-
source_dir: './tests/test-node-func/'
77-
event_trigger_type: 'providers/cloud.pubsub/eventTypes/topic.publish'
78-
event_trigger_resource: '${{ vars.PUBSUB_TOPIC_NAME }}'
79-
event_trigger_retry: true
80-
env_vars_file: './tests/env-var-files/test.good.yaml'
81-
build_environment_variables: 'FOO=bar, ZIP=zap'
82-
build_environment_variables_file: './tests/env-var-files/test.good.yaml'
83-
secret_environment_variables: |-
84-
FOO=${{ vars.SECRET_VERSION_NAME }}
85-
BAR=${{ vars.SECRET_NAME }}
86-
secret_volumes: '/etc/secrets/foo=${{ vars.SECRET_VERSION_NAME }}'
87-
service_account_email: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
88-
min_instances: 2
89-
max_instances: 5
90-
timeout: 300
70+
- id: 'deploy'
71+
uses: './'
72+
with:
73+
name: 'event-trigger-${{ github.run_number }}'
74+
runtime: 'nodejs22'
75+
entry_point: 'helloWorld'
76+
source_dir: './tests/test-node-func/'
77+
event_trigger_type: 'google.cloud.pubsub.topic.v1.messagePublished'
78+
event_trigger_pubsub_topic: '${{ vars.PUBSUB_TOPIC_NAME }}'
79+
event_trigger_retry: true
80+
environment_variables_file: './tests/env-var-files/test.good.yaml'
81+
build_environment_variables: 'FOO=bar, ZIP=zap'
82+
build_environment_variables_file: './tests/env-var-files/test.good.yaml'
83+
secret_environment_variables: |-
84+
FOO=${{ vars.SECRET_VERSION_NAME }}
85+
BAR=${{ vars.SECRET_NAME }}
86+
secret_volumes: '/etc/secrets/foo=${{ vars.SECRET_VERSION_NAME }}'
87+
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
88+
min_instance_count: 2
89+
max_instance_count: 5

.github/workflows/unit.yml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,36 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
os:
28-
- 'ubuntu-latest'
29-
- 'windows-latest'
30-
- 'macos-latest'
28+
- 'ubuntu-latest'
29+
- 'windows-latest'
30+
- 'macos-latest'
3131
runs-on: '${{ matrix.os }}'
3232

3333
steps:
34-
- uses: 'actions/checkout@v4'
35-
36-
- uses: 'actions/setup-node@v4'
37-
with:
38-
node-version: '20.x'
39-
40-
- name: 'npm build'
41-
run: 'npm ci && npm run build'
42-
43-
- name: 'npm lint'
44-
# There's no need to run the linter for each operating system, since it
45-
# will find the same thing 3x and clog up the PR review.
46-
if: ${{ matrix.os == 'ubuntu-latest' }}
47-
run: 'npm run lint'
48-
49-
- uses: 'google-github-actions/auth@v2'
50-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
51-
with:
52-
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
53-
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
54-
55-
- name: 'npm test'
56-
env:
57-
TEST_PROJECT_ID: '${{ vars.PROJECT_ID }}'
58-
TEST_SERVICE_ACCOUNT_EMAIL: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
59-
TEST_SECRET_VERSION_NAME: '${{ vars.SECRET_VERSION_NAME }}'
60-
run: 'npm run test'
34+
- uses: 'actions/checkout@v4'
35+
36+
- uses: 'actions/setup-node@v4'
37+
with:
38+
node-version: '20.x'
39+
40+
- name: 'npm build'
41+
run: 'npm ci && npm run build'
42+
43+
- name: 'npm lint'
44+
# There's no need to run the linter for each operating system, since it
45+
# will find the same thing 3x and clog up the PR review.
46+
if: ${{ matrix.os == 'ubuntu-latest' }}
47+
run: 'npm run lint'
48+
49+
- uses: 'google-github-actions/auth@v2'
50+
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
51+
with:
52+
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
53+
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
54+
55+
- name: 'npm test'
56+
env:
57+
TEST_PROJECT_ID: '${{ vars.PROJECT_ID }}'
58+
TEST_SERVICE_ACCOUNT_EMAIL: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
59+
TEST_SECRET_VERSION_NAME: '${{ vars.SECRET_VERSION_NAME }}'
60+
run: 'npm run test'

0 commit comments

Comments
 (0)