Skip to content

Commit 3edad6a

Browse files
Merge branch 'main' into model-armor-crud-with-codeowners
2 parents 0b9faee + fd6ec65 commit 3edad6a

File tree

20 files changed

+264
-90
lines changed

20 files changed

+264
-90
lines changed

.github/config/nodejs-dev.jsonc

Lines changed: 4 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,7 @@
100100
"auth",
101101
"batch",
102102
"cloud-language",
103+
"cloud-sql/mysql/mysql",
103104
"cloud-tasks/snippets",
104105
"cloud-tasks/tutorial-gcf/app",
105106
"cloud-tasks/tutorial-gcf/function",
@@ -202,6 +203,7 @@
202203
"run/image-processing",
203204
"run/jobs",
204205
"run/logging-manual",
206+
"run/idp-sql",
205207
"run/markdown-preview/editor",
206208
"run/markdown-preview/renderer",
207209
"run/pubsub",

.github/config/nodejs-prod.jsonc

Lines changed: 2 additions & 4 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,7 +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"
8180
"cloud-sql/mysql/mysql2", // (untested) Error: Cannot find module './connect-connector-with-iam-authn.js'
8281
"cloud-sql/postgres/knex", // (untested) CloudSQLConnectorError: Malformed instance connection name provided: expected format of "PROJECT:REGION:INSTANCE", got undefined
8382
"cloud-sql/sqlserver/mssql", // (untested) TypeError: The "config.server" property is required and must be of type string.
@@ -92,7 +91,6 @@
9291
"functions/slack", // TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type ... Received undefined
9392
"healthcare/fhir", // Error: Cannot find module 'whatwg-url'
9493
"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
9694
"storagetransfer", // CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
9795
"video-intelligence", // PERMISSION_DENIED: The caller does not have permission
9896
"workflows", // SyntaxError: Cannot use import statement outside a module
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/bin/bash -ex
2+
3+
# Copyright 2025 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# Shared Cloud SQL Proxy setup
18+
# Presumes the following variables in ci-setup.json:
19+
# * CLOUD_SQL_CONNECTION_NAME - the project:region:instance of a Cloud SQL instance.
20+
# * UNIX_SOCKET_DIR - a local directory to set the proxy to (default tmp/cloudsql)
21+
#
22+
# Note: in GitHub Actions environments, `/cloudsql` is not valid.
23+
# Ensure any INSTANCE_UNIX_SOCKET value is ~= $UNIX_SOCKET_DIR/$CLOUD_SQL_CONNECTION_NAME
24+
25+
usage() {
26+
cat << EOF
27+
# Usage:
28+
# CLOUD_SQL_CONNECTION_NAME=project:region:instance sql-proxy.sh [..]
29+
#
30+
# Defaults to TCP socket proxy. Set `SOCKET=unix` for Unix sockets.
31+
#
32+
# Usage in package.json:
33+
#
34+
# "proxy": "$GITHUB_WORKSPACE/.github/workflows/utils/sql-proxy.sh",
35+
# "system-test": "npm run proxy -- c8 mocha test/... ",
36+
# "system-test-unix": "SOCKET=unix npm run proxy -- c8 mocha test/... ",
37+
EOF
38+
}
39+
40+
41+
PROXY_VERSION="v2.15.1"
42+
SOCKET=${SOCKET:-tcp}
43+
44+
echop(){ # Print Echo
45+
echo "👾 $1"
46+
}
47+
48+
exit_message() { # Error Echo
49+
echo "$1"
50+
usage
51+
exit 1
52+
}
53+
54+
if [[ -z "$CLOUD_SQL_CONNECTION_NAME" ]]; then
55+
exit_message "Must provide CLOUD_SQL_CONNECTION_NAME"
56+
fi
57+
58+
if [[ $SOCKET == "unix" ]]; then
59+
UNIX_SOCKET_DIR=${UNIX_SOCKET_DIR:-"tmp/cloudsql"}
60+
61+
if [[ $UNIX_SOCKET_DIR == "/cloudsql" ]]; then
62+
exit_message "Cannot use /cloudsql in a GitHub Actions context"
63+
fi
64+
65+
mkdir -p $UNIX_SOCKET_DIR && chmod 777 $UNIX_SOCKET_DIR
66+
socket="--unix-socket $UNIX_SOCKET_DIR"
67+
fi
68+
echop "Setting up cloud-sql-proxy for $SOCKET socket connections"
69+
70+
# Download the Cloud SQL Auth Proxy (only once)
71+
if [[ ! -f cloud-sql-proxy ]]; then
72+
curl -o cloud-sql-proxy https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/${PROXY_VERSION}/cloud-sql-proxy.linux.amd64
73+
if [[ $? -ne 0 ]]; then
74+
echo "Failed to download cloud-sql-proxy"
75+
exit 1
76+
fi
77+
chmod +x cloud-sql-proxy
78+
else
79+
echo "cloud-sql-proxy already downloaded"
80+
fi
81+
82+
# Setup proxy
83+
./cloud-sql-proxy $socket $CLOUD_SQL_CONNECTION_NAME &
84+
sleep 5
85+
echop "Proxy ready for use"
86+
87+
# Run whatever command was passed to this script
88+
$@ || STATUS=$?
89+
90+
# Cleanup
91+
echop "Shutting down proxy process"
92+
pkill -f "cloud-sql-proxy" || echo "cloud-sql-proxy process not found. Was it already stopped?"
93+
94+
# Fail if the tests failed
95+
exit $STATUS

appengine/building-an-app/build/app.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313

14-
# [START app_yaml]
15-
# [START gae_app_yaml]
14+
# [START gae_build_app_yaml_node]
1615
runtime: nodejs20
17-
# [END gae_app_yaml]
18-
# [END app_yaml]
16+
# [END gae_build_app_yaml_node]

appengine/building-an-app/build/test/server.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ const supertest = require('supertest');
1515
const path = require('path');
1616
const app = require(path.join(__dirname, '../', 'server.js'));
1717

18-
1918
describe('gae_app', () => {
2019
it('should be listening', async () => {
2120
await supertest(app).get('/').expect(200);
2221
});
23-
})
22+
});
2423

2524
describe('gae_build_web_server_app', () => {
2625
it('should be listening', async () => {
2726
await supertest(app).get('/').expect(200);
2827
});
29-
})
28+
});

appengine/building-an-app/update/app.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313

14-
# [START gae_app_yaml]
15-
# [START app_yaml]
14+
# [START gae_update_app_yaml_node]
1615
runtime: nodejs20
17-
# [END app_yaml]
18-
# [END gae_app_yaml]
16+
# [END gae_update_app_yaml_node]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"env": {
3+
"INSTANCE_HOST": "127.0.0.1",
4+
"INSTANCE_CONNECTION_NAME": "nodejs-docs-samples-tests:us-central1:mysql-ci",
5+
"UNIX_SOCKET_DIR": "tmp/cloudsql",
6+
"CLOUD_SQL_CONNECTION_NAME": "$INSTANCE_CONNECTION_NAME",
7+
"INSTANCE_UNIX_SOCKET": "$UNIX_SOCKET_DIR/$INSTANCE_CONNECTION_NAME",
8+
"DB_NAME": "kokoro_ci",
9+
"DB_USER": "kokoro_ci"
10+
},
11+
"secrets": {
12+
"DB_PASS": "nodejs-docs-samples-tests/nodejs-docs-samples-sql-password"
13+
}
14+
}

cloud-sql/mysql/mysql/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
},
1414
"scripts": {
1515
"start": "node server/server.js",
16-
"system-test": "c8 mocha -p -j 2 test/server.test.js --timeout=60000 --exit",
17-
"system-test-unix": "c8 mocha -p -j 2 test/server-unix.test.js --timeout=60000 --exit",
16+
"proxy": "$GITHUB_WORKSPACE/.github/workflows/utils/sql-proxy.sh",
17+
"system-test": "npm run proxy -- c8 mocha -p -j 2 test/server.test.js --colors --timeout=60000 --exit",
18+
"system-test-unix": "SOCKET=unix npm run proxy -- c8 mocha -p -j 2 test/server-unix.test.js --colors --timeout=60000 --exit",
1819
"test": "npm run system-test && npm run system-test-unix"
1920
},
2021
"dependencies": {

recaptcha_enterprise/demosite/app/controllers/controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ const onCommentSubmit = async (req, res) => {
249249
};
250250

251251
// Classify the action as BAD/ NOT_BAD based on conditions specified.
252+
// See https://cloud.google.com/recaptcha/docs/interpret-assessment-website
252253
const checkForBadAction = function (assessmentResponse, recaptchaAction) {
253254
let label = Label.NOT_BAD;
254255
let reason = '';

run/idp-sql/ci-setup.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"env": {
3+
"SERVICE_NAME": "idp-sql-${RUN_ID}",
4+
"SAMPLE_VERSION": "${RUN_ID}",
5+
"CLOUD_SQL_CONNECTION_NAME": "nodejs-docs-samples-tests:us-central1:test-postgres-instance",
6+
"DB_NAME": "ci-database",
7+
"DB_USER": "ci-user"
8+
},
9+
"secrets": {
10+
"IDP_KEY": "nodejs-docs-samples-tests/long-door-651-idp-key",
11+
"DB_PASSWORD": "nodejs-docs-samples-tests/nodejs-docs-samples-test-postgres-instance-ci-user-password" }
12+
}

0 commit comments

Comments
 (0)