Skip to content

Commit 46ff4ee

Browse files
Merge branch 'main' into hivanalejandro/fix/Update-sample-cloud_func
2 parents 3c94794 + 8b8c2a1 commit 46ff4ee

File tree

17 files changed

+151
-79
lines changed

17 files changed

+151
-79
lines changed

.github/config/nodejs-dev.jsonc

Lines changed: 3 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",
@@ -202,6 +202,7 @@
202202
"run/image-processing",
203203
"run/jobs",
204204
"run/logging-manual",
205+
"run/idp-sql",
205206
"run/markdown-preview/editor",
206207
"run/markdown-preview/renderer",
207208
"run/pubsub",

.github/config/nodejs-prod.jsonc

Lines changed: 2 additions & 3 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",
@@ -92,7 +92,6 @@
9292
"functions/slack", // TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type ... Received undefined
9393
"healthcare/fhir", // Error: Cannot find module 'whatwg-url'
9494
"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
9695
"storagetransfer", // CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
9796
"video-intelligence", // PERMISSION_DENIED: The caller does not have permission
9897
"workflows", // SyntaxError: Cannot use import statement outside a module

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

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

14+
# [START gae_build_app_yaml_node]
1415
# [START app_yaml]
1516
# [START gae_app_yaml]
1617
runtime: nodejs20
1718
# [END gae_app_yaml]
1819
# [END app_yaml]
20+
# [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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313

14+
# [START gae_update_app_yaml_node]
1415
# [START gae_app_yaml]
1516
# [START app_yaml]
1617
runtime: nodejs20
1718
# [END app_yaml]
1819
# [END gae_app_yaml]
20+
# [END gae_update_app_yaml_node]

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+
}

run/idp-sql/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
},
1515
"scripts": {
1616
"start": "node index.js",
17-
"test": "c8 mocha -p -j 2 test/app.test.js --timeout=120000 --exit",
18-
"system-test": "c8 mocha -p -j 2 test/system.test.js --timeout=1800000 --exit"
17+
"unit-test": "c8 mocha -p -j 2 test/app.test.js --timeout=120000 --exit",
18+
"system-test": "c8 mocha -p -j 2 test/system.test.js --timeout=1800000 --exit",
19+
"all-test": "npm run unit-test && npm run system-test",
20+
"test": "npm -- run all-test"
1921
},
2022
"dependencies": {
2123
"express": "^4.16.2",
22-
"firebase-admin": "^12.0.0",
24+
"firebase-admin": "^13.0.0",
2325
"gcp-metadata": "^6.0.0",
2426
"google-auth-library": "^9.0.0",
2527
"handlebars": "^4.7.6",

run/idp-sql/test/e2e_test_cleanup.yaml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Copyright 2021 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+
116
steps:
217

318
- id: 'Delete resources'
@@ -12,11 +27,15 @@ steps:
1227
./test/retry.sh "gcloud container images describe gcr.io/${PROJECT_ID}/${_SERVICE}:${_VERSION}" \
1328
"gcloud container images delete gcr.io/${PROJECT_ID}/${_SERVICE}:${_VERSION} --quiet"
1429
15-
./test/retry.sh "gcloud run services describe ${_SERVICE} --region ${_REGION} --platform ${_PLATFORM}" \
16-
"gcloud run services delete ${_SERVICE} --region ${_REGION} --platform ${_PLATFORM} --quiet"
30+
./test/retry.sh "gcloud run services describe ${_SERVICE} --region ${_REGION}" \
31+
"gcloud run services delete ${_SERVICE} --region ${_REGION} --quiet"
1732
1833
substitutions:
1934
_SERVICE: idp-sql
2035
_VERSION: manual
2136
_REGION: us-central1
22-
_PLATFORM: managed
37+
38+
serviceAccount: 'projects/${PROJECT_ID}/serviceAccounts/${_SERVICE_ACCOUNT}'
39+
options:
40+
logging: CLOUD_LOGGING_ONLY
41+
dynamicSubstitutions: true

run/idp-sql/test/e2e_test_setup.yaml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Copyright 2021 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+
116
steps:
217

318
- id: 'Add a Secret to Secret Manager'
@@ -12,9 +27,13 @@ steps:
1227
sed -i "s/\"DB_USER\": \"postgres\"/\"DB_USER\": \"${_DB_USER}\"/" postgres-secrets.json
1328
1429
./test/retry.sh "gcloud secrets create ${_SERVICE}-secrets \
15-
--replication-policy="automatic" \
30+
--replication-policy=automatic \
1631
--data-file=postgres-secrets.json"
1732
33+
./test/retry.sh "gcloud secrets add-iam-policy-binding ${_SERVICE}-secrets \
34+
--member=serviceAccount:${_SERVICE_ACCOUNT} \
35+
--role=roles/secretmanager.secretAccessor"
36+
1837
- id: 'Build Container Image'
1938
name: 'gcr.io/cloud-builders/docker'
2039
entrypoint: '/bin/bash'
@@ -37,11 +56,11 @@ steps:
3756
args:
3857
- '-c'
3958
- |
40-
./test/retry.sh "gcloud beta run deploy ${_SERVICE} \
59+
./test/retry.sh "gcloud run deploy ${_SERVICE} \
4160
--image gcr.io/${PROJECT_ID}/${_SERVICE}:${_VERSION} \
4261
--allow-unauthenticated \
4362
--region ${_REGION} \
44-
--platform ${_PLATFORM} \
63+
--service-account ${_SERVICE_ACCOUNT} \
4564
--add-cloudsql-instances ${_CLOUD_SQL_CONNECTION_NAME} \
4665
--update-secrets CLOUD_SQL_CREDENTIALS_SECRET=${_SERVICE}-secrets:latest"
4766
@@ -52,8 +71,13 @@ substitutions:
5271
_SERVICE: idp-sql
5372
_VERSION: manual
5473
_REGION: us-central1
55-
_PLATFORM: managed
5674
_CLOUD_SQL_CONNECTION_NAME: $PROJECT_ID:us-central1:idp-sql-instance
5775
_DB_NAME: postgres
5876
_DB_USER: postgres
5977
_DB_PASSWORD: password1234
78+
_SERVICE_ACCOUNT: ${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com
79+
80+
serviceAccount: 'projects/${PROJECT_ID}/serviceAccounts/${_SERVICE_ACCOUNT}'
81+
options:
82+
logging: CLOUD_LOGGING_ONLY
83+
dynamicSubstitutions: true

0 commit comments

Comments
 (0)