Skip to content

Commit ff731fc

Browse files
authored
Merge branch 'main' into compute_snapshot_schedule_attach
2 parents 5a13996 + 47ab9d6 commit ff731fc

File tree

257 files changed

+5692
-4402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+5692
-4402
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ Note: Before submitting a pull request, please open an issue for discussion if y
88
- [ ] I have followed guidelines from [CONTRIBUTING.MD](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/CONTRIBUTING.md) and [Samples Style Guide](https://googlecloudplatform.github.io/samples-style-guide/)
99
- [ ] **Tests** pass: `npm test` (see [Testing](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/CONTRIBUTING.md#run-the-tests-for-a-single-sample))
1010
- [ ] **Lint** pass: `npm run lint` (see [Style](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/CONTRIBUTING.md#style))
11+
- [ ] **Required CI tests** pass (see [CI testing](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/CONTRIBUTING.md#ci-testing))
1112
- [ ] These samples need a new **API enabled** in testing projects to pass (let us know which ones)
1213
- [ ] These samples need a new/updated **env vars** in testing projects set to pass (let us know which ones)
1314
- [ ] This pull request is from a branch created directly off of `GoogleCloudPlatform/nodejs-docs-samples`. Not a fork.
1415
- [ ] This sample adds a new sample directory, and I updated the [CODEOWNERS file](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/CODEOWNERS) with the codeowners for this sample
1516
- [ ] This sample adds a new sample directory, and I created [GitHub Actions workflow](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/CONTRIBUTING.md#adding-new-samples) for this sample
1617
- [ ] This sample adds a new **Product API**, and I updated the [Blunderbuss issue/PR auto-assigner](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/.github/blunderbuss.yml) with the codeowners for this sample
1718
- [ ] Please **merge** this PR for me once it is approved
19+
20+
> **Note**: Any check with `(dev)`, `(experimental)`, or `(legacy)` can be ignored and should **not block** your PR from merging (see [CI testing](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/CONTRIBUTING.md#ci-testing)).

.github/blunderbuss.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ assign_issues_by:
4444
- "api: parametermanager"
4545
to:
4646
- GoogleCloudPlatform/cloud-parameters-team
47+
- labels:
48+
- "api: modelarmor"
49+
to:
50+
- GoogleCloudPlatform/cloud-modelarmor-team
4751

4852
assign_prs_by:
4953
- labels:
@@ -77,3 +81,7 @@ assign_prs_by:
7781
- "api: parametermanager"
7882
to:
7983
- GoogleCloudPlatform/cloud-parameters-team
84+
- labels:
85+
- "api: modelarmor"
86+
to:
87+
- GoogleCloudPlatform/cloud-modelarmor-team

.github/config/nodejs-dev.jsonc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
".github/ISSUE_TEMPLATE/",
3737
".github/PULL_REQUEST_TEMPLATE.md",
3838
".github/auto-label.yaml",
39-
".github/blunderbuss.yaml",
39+
".github/blunderbuss.yml",
4040
".github/flakybot.yaml",
41-
".github/header-checker-lint.yaml",
41+
".github/header-checker-lint.yml",
4242
".github/scripts/",
4343
".github/snippet-bot.yml",
4444
".github/trusted-contribution.yml",
@@ -100,6 +100,10 @@
100100
"auth",
101101
"batch",
102102
"cloud-language",
103+
"cloud-sql/mysql/mysql",
104+
"cloud-sql/mysql/mysql2",
105+
"cloud-sql/postgres/knex",
106+
"cloud-sql/sqlserver/mssql",
103107
"cloud-tasks/snippets",
104108
"cloud-tasks/tutorial-gcf/app",
105109
"cloud-tasks/tutorial-gcf/function",
@@ -202,6 +206,7 @@
202206
"run/image-processing",
203207
"run/jobs",
204208
"run/logging-manual",
209+
"run/idp-sql",
205210
"run/markdown-preview/editor",
206211
"run/markdown-preview/renderer",
207212
"run/pubsub",
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
".github/ISSUE_TEMPLATE/",
3737
".github/PULL_REQUEST_TEMPLATE.md",
3838
".github/auto-label.yaml",
39-
".github/blunderbuss.yaml",
39+
".github/blunderbuss.yml",
4040
".github/flakybot.yaml",
41-
".github/header-checker-lint.yaml",
41+
".github/header-checker-lint.yml",
4242
".github/scripts/",
4343
".github/snippet-bot.yml",
4444
".github/trusted-contribution.yml",
@@ -77,10 +77,6 @@
7777
// TODO: fix these
7878
"ai-platform/snippets", // PERMISSION_DENIED: Permission denied: Consumer 'projects/undefined' has been suspended.
7979
"automl", // (untested) FAILED_PRECONDITION: Google Cloud AutoML Natural Language was retired on March 15, 2024. Please migrate to Vertex AI instead
80-
"cloud-sql/mysql/mysql", // (untested) Error: expected 200 "OK", got 500 "Internal Server Error"
81-
"cloud-sql/mysql/mysql2", // (untested) Error: Cannot find module './connect-connector-with-iam-authn.js'
82-
"cloud-sql/postgres/knex", // (untested) CloudSQLConnectorError: Malformed instance connection name provided: expected format of "PROJECT:REGION:INSTANCE", got undefined
83-
"cloud-sql/sqlserver/mssql", // (untested) TypeError: The "config.server" property is required and must be of type string.
8480
"cloud-sql/sqlserver/tedious", // (untested) TypeError: The "config.server" property is required and must be of type string.
8581
"compute", // GoogleError: The resource 'projects/long-door-651/zones/us-central1-a/disks/disk-from-pool-name' was not found
8682
"dataproc", // GoogleError: Error submitting create cluster request: Multiple validation errors
@@ -92,7 +88,6 @@
9288
"functions/slack", // TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type ... Received undefined
9389
"healthcare/fhir", // Error: Cannot find module 'whatwg-url'
9490
"iam/deny", // PERMISSION_DENIED: Permission iam.googleapis.com/denypolicies.create denied on resource cloudresourcemanager.googleapis.com/projects/long-door-651
95-
"run/idp-sql", // (untested) Error: Invalid contents in the credentials file
9691
"storagetransfer", // CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
9792
"video-intelligence", // PERMISSION_DENIED: The caller does not have permission
9893
"workflows", // SyntaxError: Cannot use import statement outside a module

.github/workflows/ai-platform-snippets.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
id: npm-cache-dir
6363
shell: bash
6464
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
65-
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
65+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
6666
id: npm-cache
6767
with:
6868
path: ${{ steps.npm-cache-dir.outputs.dir }}
@@ -82,7 +82,7 @@ jobs:
8282
CAIP_PROJECT_ID: ${{ steps.secrets.outputs.caip_id }}
8383
- name: upload test results for FlakyBot workflow
8484
if: github.event.action == 'schedule' && always()
85-
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
85+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
8686
env:
8787
MOCHA_REPORTER_OUTPUT: "${{github.run_id}}_sponge_log.xml"
8888
with:

.github/workflows/ci-scripts.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
working-directory: .github/scripts
3232
steps:
3333
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
34-
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
34+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
3535
with:
3636
node-version: 20
3737
- run: npm install

.github/workflows/custard-ci-dev.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: custard CI (dev)
15+
name: (legacy dev) Custard CI
1616
on:
1717
push:
1818
branches:
@@ -27,7 +27,7 @@ env:
2727

2828
jobs:
2929
affected:
30-
name: Finding affected tests
30+
name: (legacy) Finding affected tests
3131
runs-on: ubuntu-latest
3232
timeout-minutes: 2
3333
outputs:
@@ -40,12 +40,12 @@ jobs:
4040
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
4141
with:
4242
repository: GoogleCloudPlatform/cloud-samples-tools
43-
ref: v0.2.1
43+
ref: v0.3.2
4444
path: cloud-samples-tools
4545
- name: Create `bin` directory for cloud-samples-tools binaries
4646
run: mkdir bin
4747
working-directory: cloud-samples-tools
48-
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
48+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
4949
with:
5050
go-version: ${{ env.GO_VERSION }}
5151
- name: Build Custard (from cloud-samples-tools)
@@ -61,7 +61,8 @@ jobs:
6161
echo "setups=$(./cloud-samples-tools/bin/custard setup-files .github/config/nodejs-dev.jsonc paths.txt)" >> $GITHUB_OUTPUT
6262
6363
nodejs-test:
64-
name: test
64+
if: github.event.pull_request && github.event.pull_request.head.repo.fork == false
65+
name: (legacy) test
6566
needs: affected
6667
runs-on: ubuntu-latest
6768
timeout-minutes: 120 # 2 hours hard limit
@@ -81,7 +82,7 @@ jobs:
8182
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
8283
with:
8384
ref: ${{ github.event.pull_request.head.sha }}
84-
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
85+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
8586
with:
8687
node-version: ${{ fromJson(env.CI_SETUP).node-version }}
8788
- uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f # v2

.github/workflows/custard-ci.yaml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: custard CI
15+
# IMPORTANT: DO NOT CHANGE THE NAME OF THIS WORKFLOW!
16+
# The workflow named "Custard CI" triggers both custard-run.yaml and custard-run-dev.yaml.
17+
# TODO: To sunset old tests remove `affected`, `lint`, and `test` jobs (only keep `region-tags`).
18+
name: Custard CI
1619
on:
1720
push:
1821
branches:
@@ -25,9 +28,10 @@ on:
2528
env:
2629
GO_VERSION: ^1.22.0
2730

31+
# TODO: remove all jobs except region-tags (should be tested by custard-run workflows)
2832
jobs:
2933
affected:
30-
name: Finding affected tests
34+
name: (legacy) Finding affected tests
3135
runs-on: ubuntu-latest
3236
timeout-minutes: 2
3337
outputs:
@@ -40,12 +44,12 @@ jobs:
4044
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
4145
with:
4246
repository: GoogleCloudPlatform/cloud-samples-tools
43-
ref: v0.2.1
47+
ref: v0.3.2
4448
path: cloud-samples-tools
4549
- name: Create `bin` directory for cloud-samples-tools binaries
4650
run: mkdir bin
4751
working-directory: cloud-samples-tools
48-
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
52+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5
4953
with:
5054
go-version: ${{ env.GO_VERSION }}
5155
- name: Build Custard (from cloud-samples-tools)
@@ -56,9 +60,9 @@ jobs:
5660
- name: Find Node.js affected packages
5761
id: nodejs
5862
run: |
59-
echo "paths=$(./cloud-samples-tools/bin/custard affected .github/config/nodejs-prod.jsonc diffs.txt paths.txt)" >> $GITHUB_OUTPUT
63+
echo "paths=$(./cloud-samples-tools/bin/custard affected .github/config/nodejs.jsonc diffs.txt paths.txt)" >> $GITHUB_OUTPUT
6064
cat paths.txt
61-
echo "setups=$(./cloud-samples-tools/bin/custard setup-files .github/config/nodejs-prod.jsonc paths.txt)" >> $GITHUB_OUTPUT
65+
echo "setups=$(./cloud-samples-tools/bin/custard setup-files .github/config/nodejs.jsonc paths.txt)" >> $GITHUB_OUTPUT
6266
6367
lint:
6468
needs: affected
@@ -68,7 +72,7 @@ jobs:
6872
- name: Checkout
6973
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
7074
- name: Setup Node
71-
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
75+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
7276
with:
7377
node-version: 20
7478
- run: npm install
@@ -112,12 +116,14 @@ jobs:
112116
timeout-minutes: 5
113117
steps:
114118
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
115-
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
119+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
116120
with:
117121
node-version: 20
118122
- run: ./.github/workflows/utils/region-tags-tests.sh
119123

120124
test:
125+
if: github.event.pull_request && github.event.pull_request.head.repo.fork == false
126+
name: (legacy) test
121127
needs: affected
122128
runs-on: ubuntu-latest
123129
timeout-minutes: 120 # 2 hours hard limit
@@ -137,7 +143,7 @@ jobs:
137143
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
138144
with:
139145
ref: ${{ github.event.pull_request.head.sha }}
140-
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
146+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
141147
with:
142148
node-version: ${{ fromJson(env.CI_SETUP).node-version }}
143149
- uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f # v2
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: (dev) Custard run
16+
17+
on:
18+
# Run tests when a pull request is created or updated.
19+
# This allows to run tests from forked repos (after reviewer's approval).
20+
workflow_run:
21+
workflows:
22+
- Custard CI # .github/workflows/custard-ci.yaml
23+
types:
24+
- in_progress
25+
26+
# Run tests again as validation when a PR merge into main.
27+
push:
28+
branches:
29+
- main
30+
31+
# To do manual runs through the Actions UI.
32+
workflow_dispatch:
33+
inputs:
34+
run-all:
35+
description: Run all tests
36+
type: boolean
37+
default: false
38+
paths:
39+
description: Comma separated packages to test
40+
type: string
41+
ref:
42+
description: Branch, tag, or commit SHA to run tests on
43+
type: string
44+
default: main
45+
46+
jobs:
47+
affected:
48+
uses: GoogleCloudPlatform/cloud-samples-tools/.github/workflows/affected.yaml@9ee708234e240605d96e78f652c333ed6aa95a23 # v0.3.2
49+
permissions:
50+
statuses: write
51+
with:
52+
head-sha: ${{ github.event.workflow_run.head_sha || inputs.ref || github.sha }}
53+
config-file: .github/config/nodejs-dev.jsonc
54+
paths: ${{ (inputs.run-all && '.') || inputs.paths || '' }}
55+
check-name: (dev) Custard CI / tests
56+
create-check-if: ${{ !!github.event.workflow_run }}
57+
58+
test:
59+
if: needs.affected.outputs.paths != '[]'
60+
needs: affected
61+
runs-on: ubuntu-latest
62+
timeout-minutes: 120 # 2 hours hard limit
63+
permissions:
64+
id-token: write
65+
statuses: write
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
path: ${{ needs.affected.outputs.paths }}
70+
continue-on-error: true
71+
env:
72+
GOOGLE_SAMPLES_PROJECT: long-door-651
73+
SERVICE_ACCOUNT: [email protected]
74+
steps:
75+
- name: Check queued
76+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/create-check@9ee708234e240605d96e78f652c333ed6aa95a23 # v0.3.2
77+
id: queued
78+
with:
79+
sha: ${{ github.event.workflow_run.head_sha || inputs.ref || github.sha }}
80+
name: (dev) Custard CI / ${{ github.job }} (${{ matrix.path }})
81+
job-name: ${{ github.job }} (${{ matrix.path }})
82+
if: ${{ !!github.event.workflow_run }}
83+
- name: Checkout
84+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
85+
with:
86+
ref: ${{ github.event.workflow_run.head_sha || inputs.ref || github.sha }}
87+
- name: Authenticate
88+
uses: google-github-actions/auth@ba79af03959ebeac9769e648f473a284504d9193 # v2.1.10
89+
id: auth
90+
with:
91+
project_id: ${{ env.GOOGLE_SAMPLES_PROJECT }}
92+
workload_identity_provider: projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider
93+
service_account: ${{ env.SERVICE_ACCOUNT }}
94+
access_token_lifetime: 600s # 10 minutes
95+
token_format: id_token
96+
id_token_audience: https://action.test/ # service must have this custom audience
97+
id_token_include_email: true
98+
- name: Setup Custard
99+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/setup-custard@9ee708234e240605d96e78f652c333ed6aa95a23 # v0.3.2
100+
with:
101+
path: ${{ matrix.path }}
102+
ci-setup: ${{ toJson(fromJson(needs.affected.outputs.ci-setups)[matrix.path]) }}
103+
id-token: ${{ steps.auth.outputs.id_token }}
104+
- name: Check in_progress
105+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/update-check@9ee708234e240605d96e78f652c333ed6aa95a23 # v0.3.2
106+
id: in_progress
107+
with:
108+
check: ${{ steps.queued.outputs.check }}
109+
status: in_progress
110+
- name: Run tests for ${{ matrix.path }}
111+
run: |
112+
timeout ${{ fromJson(needs.affected.outputs.ci-setups)[matrix.path].timeout-minutes }}m \
113+
make test dir=${{ matrix.path }}
114+
env:
115+
# TODO: remove this when the self-contained runner lands.
116+
SERVICE_ACCOUNT: [email protected]
117+
- name: Check success
118+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/update-check@9ee708234e240605d96e78f652c333ed6aa95a23 # v0.3.2
119+
with:
120+
check: ${{ steps.in_progress.outputs.check }}
121+
status: success
122+
- name: Check failure
123+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/update-check@9ee708234e240605d96e78f652c333ed6aa95a23 # v0.3.2
124+
if: failure()
125+
with:
126+
check: ${{ steps.in_progress.outputs.check }}
127+
status: failure
128+
129+
done:
130+
needs: [affected, test]
131+
if: always()
132+
runs-on: ubuntu-latest
133+
permissions:
134+
statuses: write
135+
steps:
136+
- name: Check success
137+
uses: GoogleCloudPlatform/cloud-samples-tools/actions/steps/update-check@9ee708234e240605d96e78f652c333ed6aa95a23 # v0.3.2
138+
with:
139+
check: ${{ needs.affected.outputs.check }}
140+
status: success

0 commit comments

Comments
 (0)