Skip to content

chore: node 16 upgrade 🚧 [WIP] #3309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
56de484
chore: switch from node 14 -> 16
pattishin Jun 28, 2023
280fbca
chore: updating old node ref to v16
pattishin Jun 29, 2023
dc113e1
fix: put minimum node v16
pattishin Jul 5, 2023
c0c3d49
refactor: updating kokoro image (anticipating) v16 puppeteer update
pattishin Jul 5, 2023
e5982fd
Merge branch 'main' into chore/node-16-upgrade
pattishin Jul 6, 2023
96b03a0
Merge branch 'main' into chore/node-16-upgrade
pattishin Jul 13, 2023
9c472ca
Merge branch 'main' into chore/node-16-upgrade
kweinmeister Jul 13, 2023
0ad867b
Merge branch 'main' into chore/node-16-upgrade
kweinmeister Jul 15, 2023
935f124
Merge branch 'main' into chore/node-16-upgrade
pattishin Jul 17, 2023
e63ba22
Merge branch 'main' into chore/node-16-upgrade
pattishin Jul 18, 2023
b2ccb67
Merge branch 'main' into chore/node-16-upgrade
pattishin Jul 21, 2023
2da6e5a
Merge branch 'main' into chore/node-16-upgrade
pattishin Jul 27, 2023
8b77d16
Merge branch 'main' into chore/node-16-upgrade
pattishin Jul 29, 2023
9a65f18
Merge branch 'main' into chore/node-16-upgrade
pattishin Aug 2, 2023
4f87fae
Merge branch 'main' into chore/node-16-upgrade
pattishin Aug 2, 2023
c2c0c7a
Merge branch 'main' into chore/node-16-upgrade
pattishin Aug 7, 2023
e5e4f58
Merge branch 'main' into chore/node-16-upgrade
pattishin Aug 8, 2023
d1f5d2e
refactor: update imagemagick test with try catch and throw assert err…
pattishin Aug 8, 2023
f202111
test: adding additional try catch for ff fetch, adding debugging log
pattishin Aug 8, 2023
53a62ca
refactor: wrapping ffProcHandler with try/catch
pattishin Aug 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- uses: actions/[email protected]
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
- run: npm install
- run: npm run lint
docs:
Expand Down
4 changes: 2 additions & 2 deletions .kokoro/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ build_file: "nodejs-docs-samples/.kokoro/trampoline.sh"
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user"
value: "gcr.io/cloud-devrel-kokoro-resources/node:16-user"
}

# Export XUnit test results for further analysis
action {
define_artifacts {
regex: "**/*sponge_log.xml"
}
}
}
2 changes: 1 addition & 1 deletion .kokoro/functions/billing-periodic.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env_vars: {
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user"
value: "gcr.io/cloud-devrel-kokoro-resources/node:16-user"
}

# Tell the trampoline which build file to use.
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/functions/imagemagick.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env_vars: {
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user"
value: "gcr.io/cloud-devrel-kokoro-resources/node:16-user"
}

# Tell the trampoline which build file to use.
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/functions/ocr-app.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env_vars: {
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user"
value: "gcr.io/cloud-devrel-kokoro-resources/node:16-user"
}

# Tell the trampoline which build file to use.
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/run/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env_vars: {
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user"
value: "gcr.io/cloud-devrel-kokoro-resources/node:16-user"
}

# Export XUnit test results for further analysis
Expand Down
2 changes: 1 addition & 1 deletion cloud-sql/mysql/mysql2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
"node": ">=14.0.0"
"node": ">=16.0.0"
},
"scripts": {
"start": "node server/server.js",
Expand Down
2 changes: 1 addition & 1 deletion cloud-tasks/snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Google Inc.",
"private": true,
"engines": {
"node": ">=14.0.0"
"node": ">=16.0.0"
},
"files": [
"*.js"
Expand Down
102 changes: 65 additions & 37 deletions functions/imagemagick/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -80,45 +80,64 @@ describe('functions/imagemagick tests', () => {
const PORT = 8080;
const {ffProc, ffProcHandler} = await startFF(PORT);

await request({
url: `http://localhost:${PORT}/blurOffensiveImages`,
method: 'POST',
data: {
try {
await request({
url: `http://localhost:${PORT}/blurOffensiveImages`,
method: 'POST',
data: {
bucket: BUCKET_NAME,
name: testFiles.safe,
data: {
bucket: BUCKET_NAME,
name: testFiles.safe,
},
},
},
});
});
} catch(error) {
assert.fail(error);
}

ffProc.kill();
const stdout = await ffProcHandler;
assert.ok(stdout.includes(`Detected ${testFiles.safe} as OK.`));

try {
const stdout = await ffProcHandler;
assert.ok(stdout.includes(`Detected ${testFiles.safe} as OK.`));
} catch(error) {
assert.fail(error);
}
});

it('blurOffensiveImages successfully blurs offensive images', async () => {
const PORT = 8081;
const {ffProc, ffProcHandler} = await startFF(PORT);

await request({
url: `http://localhost:${PORT}/blurOffensiveImages`,
method: 'POST',
data: {
try {
await request({
url: `http://localhost:${PORT}/blurOffensiveImages`,
method: 'POST',
data: {
bucket: BUCKET_NAME,
name: testFiles.offensive,
data: {
bucket: BUCKET_NAME,
name: testFiles.offensive,
},
},
},
});
});
} catch(error) {
assert.fail(error);
}

ffProc.kill();
const stdout = await ffProcHandler;

assert.ok(stdout.includes(`Blurred image: ${testFiles.offensive}`));
assert.ok(
stdout.includes(
`Uploaded blurred image to: gs://${BLURRED_BUCKET_NAME}/${testFiles.offensive}`
)
);

try {
const stdout = await ffProcHandler;

assert.ok(stdout.includes(`Blurred image: ${testFiles.offensive}`));
assert.ok(
stdout.includes(
`Uploaded blurred image to: gs://${BLURRED_BUCKET_NAME}/${testFiles.offensive}`
)
);
} catch(error) {
assert.fail(error);
}

const exists = await storage
.bucket(BLURRED_BUCKET_NAME)
Expand All @@ -132,20 +151,29 @@ describe('functions/imagemagick tests', () => {
const {ffProc, ffProcHandler} = await startFF(PORT);
const missingFileName = 'file-does-not-exist.jpg';

await request({
url: `http://localhost:${PORT}/blurOffensiveImages`,
method: 'POST',
data: {
try {
await request({
url: `http://localhost:${PORT}/blurOffensiveImages`,
method: 'POST',
data: {
bucket: BUCKET_NAME,
name: missingFileName,
data: {
bucket: BUCKET_NAME,
name: missingFileName,
},
},
},
});
});
} catch(error) {
assert.fail(error);
}

ffProc.kill();
const stdout = await ffProcHandler;
assert.ok(stdout.includes(`Detected ${missingFileName} as OK.`));

try {
const stdout = await ffProcHandler;
assert.ok(stdout.includes(`Detected ${missingFileName} as OK.`));
} catch(error) {
assert.fail(error);
}
});
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "Apache-2.0",
"author": "Google Inc.",
"engines": {
"node": ">=14.0.0"
"node": ">=16.0.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"rebaseStalePrs": false,
"force": {
"constraints": {
"node": "< 15.0.0"
"node": ">= 16.0.0"
}
}
}
2 changes: 1 addition & 1 deletion run/idp-sql/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Use the official lightweight Node.js image.
# https://hub.docker.com/_/node
FROM node:14-slim
FROM node:16-slim

# Create and change to the app directory.
WORKDIR /usr/src/app
Expand Down
2 changes: 1 addition & 1 deletion run/idp-sql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
"node": ">=12.0.0"
"node": ">=16.0.0"
},
"scripts": {
"start": "node index.js",
Expand Down
3 changes: 3 additions & 0 deletions run/websockets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"private": true,
"license": "Apache Version 2.0",
"author": "Google LLC",
"engines": {
"node": ">=16.x.x"
},
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 0",
Expand Down
2 changes: 1 addition & 1 deletion workflows/invoke-private-endpoint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
"node": ">=14.0.0"
"node": ">=16.0.0"
},
"scripts": {
"start": "node app.js",
Expand Down
2 changes: 1 addition & 1 deletion workflows/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=12.0.0"
"node": ">=16.0.0"
},
"scripts": {
"build": "tsc -p .",
Expand Down