From fbc5494e24aa6e36e7a6a643aa83fe8a08803643 Mon Sep 17 00:00:00 2001 From: Daniel Bankhead Date: Fri, 8 Apr 2022 18:50:51 -0700 Subject: [PATCH 1/6] build!: Set Node v12 to minimum supported version Drops Node 10 support, which has been EOL for about 1 year. --- .github/workflows/ci.yaml | 2 +- .kokoro/common.cfg | 2 +- .kokoro/continuous/node10/common.cfg | 2 +- .kokoro/presubmit/node10/common.cfg | 2 +- .kokoro/release/docs.cfg | 2 +- .kokoro/release/docs.sh | 2 +- .kokoro/samples-test.sh | 2 +- .kokoro/system-test.sh | 2 +- .kokoro/test.sh | 2 +- .kokoro/trampoline_v2.sh | 2 +- package.json | 2 +- samples/package.json | 2 +- samples/puppeteer/package.json | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 35414632..f447b84a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [10, 12, 14, 16] + node: [12, 14, 16] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg index 03e6b50b..8e9e508e 100644 --- a/.kokoro/common.cfg +++ b/.kokoro/common.cfg @@ -16,7 +16,7 @@ build_file: "google-auth-library-nodejs/.kokoro/trampoline_v2.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" } env_vars: { key: "TRAMPOLINE_BUILD_FILE" diff --git a/.kokoro/continuous/node10/common.cfg b/.kokoro/continuous/node10/common.cfg index d144aee1..c44001d8 100644 --- a/.kokoro/continuous/node10/common.cfg +++ b/.kokoro/continuous/node10/common.cfg @@ -26,7 +26,7 @@ build_file: "google-auth-library-nodejs/.kokoro/trampoline_v2.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" } env_vars: { key: "TRAMPOLINE_BUILD_FILE" diff --git a/.kokoro/presubmit/node10/common.cfg b/.kokoro/presubmit/node10/common.cfg index d144aee1..c44001d8 100644 --- a/.kokoro/presubmit/node10/common.cfg +++ b/.kokoro/presubmit/node10/common.cfg @@ -26,7 +26,7 @@ build_file: "google-auth-library-nodejs/.kokoro/trampoline_v2.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" } env_vars: { key: "TRAMPOLINE_BUILD_FILE" diff --git a/.kokoro/release/docs.cfg b/.kokoro/release/docs.cfg index 8f8a1316..02c51cf2 100644 --- a/.kokoro/release/docs.cfg +++ b/.kokoro/release/docs.cfg @@ -11,7 +11,7 @@ before_action { # doc publications use a Python image. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" } # Download trampoline resources. diff --git a/.kokoro/release/docs.sh b/.kokoro/release/docs.sh index 4c866c86..14fabc0f 100755 --- a/.kokoro/release/docs.sh +++ b/.kokoro/release/docs.sh @@ -16,7 +16,7 @@ set -eo pipefail -# build jsdocs (Python is installed on the Node 10 docker image). +# build jsdocs (Python is installed on the Node 12 docker image). if [[ -z "$CREDENTIALS" ]]; then # if CREDENTIALS are explicitly set, assume we're testing locally # and don't set NPM_CONFIG_PREFIX. diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index f249d3e4..fbc058a4 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -56,7 +56,7 @@ fi # codecov combines coverage across integration and unit tests. Include # the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=10 +COVERAGE_NODE=12 if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then NYC_BIN=./node_modules/nyc/bin/nyc.js if [ -f "$NYC_BIN" ]; then diff --git a/.kokoro/system-test.sh b/.kokoro/system-test.sh index 0a840452..87fa0653 100755 --- a/.kokoro/system-test.sh +++ b/.kokoro/system-test.sh @@ -49,7 +49,7 @@ npm run system-test # codecov combines coverage across integration and unit tests. Include # the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=10 +COVERAGE_NODE=12 if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then NYC_BIN=./node_modules/nyc/bin/nyc.js if [ -f "$NYC_BIN" ]; then diff --git a/.kokoro/test.sh b/.kokoro/test.sh index af1ce7e3..a5c7ac04 100755 --- a/.kokoro/test.sh +++ b/.kokoro/test.sh @@ -39,7 +39,7 @@ npm test # codecov combines coverage across integration and unit tests. Include # the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=10 +COVERAGE_NODE=12 if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then NYC_BIN=./node_modules/nyc/bin/nyc.js if [ -f "$NYC_BIN" ]; then diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 4d031121..5c3d9012 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -44,7 +44,7 @@ # the project root. # # Here is an example for running this script. -# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:10-user \ +# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:12-user \ # TRAMPOLINE_BUILD_FILE=.kokoro/system-test.sh \ # .kokoro/trampoline_v2.sh diff --git a/package.json b/package.json index 70450d2a..1e017155 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "author": "Google Inc.", "description": "Google APIs Authentication Client Library for Node.js", "engines": { - "node": ">=10" + "node": ">=12" }, "main": "./build/src/index.js", "types": "./build/src/index.d.ts", diff --git a/samples/package.json b/samples/package.json index f0d1e038..e26fc245 100644 --- a/samples/package.json +++ b/samples/package.json @@ -9,7 +9,7 @@ "test": "mocha --timeout 60000" }, "engines": { - "node": ">=10" + "node": ">=12" }, "license": "Apache-2.0", "dependencies": { diff --git a/samples/puppeteer/package.json b/samples/puppeteer/package.json index ce54cfb0..9c38a8b1 100644 --- a/samples/puppeteer/package.json +++ b/samples/puppeteer/package.json @@ -4,7 +4,7 @@ "description": "An example of using puppeteer to orchestrate a Google sign in flow.", "main": "oauth2-test.js", "engines": { - "node": ">=8" + "node": ">=12" }, "scripts": { "start": "node oauth2-test.js" From ad938cee308ec4bbd963e220ccb838b35853c785 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Sat, 9 Apr 2022 01:59:35 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .github/workflows/ci.yaml | 2 +- .kokoro/common.cfg | 2 +- .kokoro/continuous/node10/common.cfg | 2 +- .kokoro/presubmit/node10/common.cfg | 2 +- .kokoro/release/docs.cfg | 2 +- .kokoro/release/docs.sh | 2 +- .kokoro/samples-test.sh | 2 +- .kokoro/system-test.sh | 2 +- .kokoro/test.sh | 2 +- .kokoro/trampoline_v2.sh | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f447b84a..35414632 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [12, 14, 16] + node: [10, 12, 14, 16] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg index 8e9e508e..03e6b50b 100644 --- a/.kokoro/common.cfg +++ b/.kokoro/common.cfg @@ -16,7 +16,7 @@ build_file: "google-auth-library-nodejs/.kokoro/trampoline_v2.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" } env_vars: { key: "TRAMPOLINE_BUILD_FILE" diff --git a/.kokoro/continuous/node10/common.cfg b/.kokoro/continuous/node10/common.cfg index c44001d8..d144aee1 100644 --- a/.kokoro/continuous/node10/common.cfg +++ b/.kokoro/continuous/node10/common.cfg @@ -26,7 +26,7 @@ build_file: "google-auth-library-nodejs/.kokoro/trampoline_v2.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" } env_vars: { key: "TRAMPOLINE_BUILD_FILE" diff --git a/.kokoro/presubmit/node10/common.cfg b/.kokoro/presubmit/node10/common.cfg index c44001d8..d144aee1 100644 --- a/.kokoro/presubmit/node10/common.cfg +++ b/.kokoro/presubmit/node10/common.cfg @@ -26,7 +26,7 @@ build_file: "google-auth-library-nodejs/.kokoro/trampoline_v2.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" } env_vars: { key: "TRAMPOLINE_BUILD_FILE" diff --git a/.kokoro/release/docs.cfg b/.kokoro/release/docs.cfg index 02c51cf2..8f8a1316 100644 --- a/.kokoro/release/docs.cfg +++ b/.kokoro/release/docs.cfg @@ -11,7 +11,7 @@ before_action { # doc publications use a Python image. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" } # Download trampoline resources. diff --git a/.kokoro/release/docs.sh b/.kokoro/release/docs.sh index 14fabc0f..4c866c86 100755 --- a/.kokoro/release/docs.sh +++ b/.kokoro/release/docs.sh @@ -16,7 +16,7 @@ set -eo pipefail -# build jsdocs (Python is installed on the Node 12 docker image). +# build jsdocs (Python is installed on the Node 10 docker image). if [[ -z "$CREDENTIALS" ]]; then # if CREDENTIALS are explicitly set, assume we're testing locally # and don't set NPM_CONFIG_PREFIX. diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index fbc058a4..f249d3e4 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -56,7 +56,7 @@ fi # codecov combines coverage across integration and unit tests. Include # the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=12 +COVERAGE_NODE=10 if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then NYC_BIN=./node_modules/nyc/bin/nyc.js if [ -f "$NYC_BIN" ]; then diff --git a/.kokoro/system-test.sh b/.kokoro/system-test.sh index 87fa0653..0a840452 100755 --- a/.kokoro/system-test.sh +++ b/.kokoro/system-test.sh @@ -49,7 +49,7 @@ npm run system-test # codecov combines coverage across integration and unit tests. Include # the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=12 +COVERAGE_NODE=10 if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then NYC_BIN=./node_modules/nyc/bin/nyc.js if [ -f "$NYC_BIN" ]; then diff --git a/.kokoro/test.sh b/.kokoro/test.sh index a5c7ac04..af1ce7e3 100755 --- a/.kokoro/test.sh +++ b/.kokoro/test.sh @@ -39,7 +39,7 @@ npm test # codecov combines coverage across integration and unit tests. Include # the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=12 +COVERAGE_NODE=10 if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then NYC_BIN=./node_modules/nyc/bin/nyc.js if [ -f "$NYC_BIN" ]; then diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 5c3d9012..4d031121 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -44,7 +44,7 @@ # the project root. # # Here is an example for running this script. -# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:12-user \ +# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:10-user \ # TRAMPOLINE_BUILD_FILE=.kokoro/system-test.sh \ # .kokoro/trampoline_v2.sh From 91a9f43458be0d23d9f97bbf3c797ebb9965c697 Mon Sep 17 00:00:00 2001 From: Daniel Bankhead Date: Thu, 14 Apr 2022 14:07:46 -0700 Subject: [PATCH 3/6] build: Drop Node 10 Support --- .github/workflows/ci.yaml | 2 +- .kokoro/common.cfg | 2 +- .kokoro/continuous/node10/common.cfg | 34 ----------------------- .kokoro/continuous/node10/docs.cfg | 4 --- .kokoro/continuous/node10/test.cfg | 9 ------ .kokoro/continuous/node8/browser-test.cfg | 12 -------- .kokoro/continuous/node8/common.cfg | 24 ---------------- .kokoro/continuous/node8/test.cfg | 0 .kokoro/presubmit/node10/common.cfg | 34 ----------------------- .kokoro/presubmit/node10/docs.cfg | 4 --- .kokoro/presubmit/node10/lint.cfg | 4 --- .kokoro/presubmit/node10/test.cfg | 0 .kokoro/release/docs.cfg | 2 +- .kokoro/release/docs.sh | 2 +- .kokoro/samples-test.sh | 2 +- .kokoro/system-test.sh | 2 +- .kokoro/test.sh | 2 +- .kokoro/trampoline_v2.sh | 2 +- package.json | 2 +- 19 files changed, 9 insertions(+), 134 deletions(-) delete mode 100644 .kokoro/continuous/node10/common.cfg delete mode 100644 .kokoro/continuous/node10/docs.cfg delete mode 100644 .kokoro/continuous/node10/test.cfg delete mode 100644 .kokoro/continuous/node8/browser-test.cfg delete mode 100644 .kokoro/continuous/node8/common.cfg delete mode 100644 .kokoro/continuous/node8/test.cfg delete mode 100644 .kokoro/presubmit/node10/common.cfg delete mode 100644 .kokoro/presubmit/node10/docs.cfg delete mode 100644 .kokoro/presubmit/node10/lint.cfg delete mode 100644 .kokoro/presubmit/node10/test.cfg diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 35414632..f447b84a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [10, 12, 14, 16] + node: [12, 14, 16] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg index 03e6b50b..8e9e508e 100644 --- a/.kokoro/common.cfg +++ b/.kokoro/common.cfg @@ -16,7 +16,7 @@ build_file: "google-auth-library-nodejs/.kokoro/trampoline_v2.sh" # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" } env_vars: { key: "TRAMPOLINE_BUILD_FILE" diff --git a/.kokoro/continuous/node10/common.cfg b/.kokoro/continuous/node10/common.cfg deleted file mode 100644 index d144aee1..00000000 --- a/.kokoro/continuous/node10/common.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Bring in codecov.io token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "google-auth-library-nodejs/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/google-auth-library-nodejs/.kokoro/test.sh" -} diff --git a/.kokoro/continuous/node10/docs.cfg b/.kokoro/continuous/node10/docs.cfg deleted file mode 100644 index 213beda5..00000000 --- a/.kokoro/continuous/node10/docs.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/google-auth-library-nodejs/.kokoro/docs.sh" -} diff --git a/.kokoro/continuous/node10/test.cfg b/.kokoro/continuous/node10/test.cfg deleted file mode 100644 index 609c0cf0..00000000 --- a/.kokoro/continuous/node10/test.cfg +++ /dev/null @@ -1,9 +0,0 @@ -# Bring in codecov.io token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} diff --git a/.kokoro/continuous/node8/browser-test.cfg b/.kokoro/continuous/node8/browser-test.cfg deleted file mode 100644 index fb5125fb..00000000 --- a/.kokoro/continuous/node8/browser-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:8-puppeteer" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/google-auth-library-nodejs/.kokoro/browser-test.sh" -} diff --git a/.kokoro/continuous/node8/common.cfg b/.kokoro/continuous/node8/common.cfg deleted file mode 100644 index e3a36c7f..00000000 --- a/.kokoro/continuous/node8/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "google-auth-library-nodejs/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/google-auth-library-nodejs/.kokoro/test.sh" -} diff --git a/.kokoro/continuous/node8/test.cfg b/.kokoro/continuous/node8/test.cfg deleted file mode 100644 index e69de29b..00000000 diff --git a/.kokoro/presubmit/node10/common.cfg b/.kokoro/presubmit/node10/common.cfg deleted file mode 100644 index d144aee1..00000000 --- a/.kokoro/presubmit/node10/common.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Bring in codecov.io token into the build as $KOKORO_KEYSTORE_DIR/73713_dpebot_codecov_token -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "google-auth-library-nodejs/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/google-auth-library-nodejs/.kokoro/test.sh" -} diff --git a/.kokoro/presubmit/node10/docs.cfg b/.kokoro/presubmit/node10/docs.cfg deleted file mode 100644 index 213beda5..00000000 --- a/.kokoro/presubmit/node10/docs.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/google-auth-library-nodejs/.kokoro/docs.sh" -} diff --git a/.kokoro/presubmit/node10/lint.cfg b/.kokoro/presubmit/node10/lint.cfg deleted file mode 100644 index 49ffcd82..00000000 --- a/.kokoro/presubmit/node10/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/google-auth-library-nodejs/.kokoro/lint.sh" -} diff --git a/.kokoro/presubmit/node10/test.cfg b/.kokoro/presubmit/node10/test.cfg deleted file mode 100644 index e69de29b..00000000 diff --git a/.kokoro/release/docs.cfg b/.kokoro/release/docs.cfg index 8f8a1316..02c51cf2 100644 --- a/.kokoro/release/docs.cfg +++ b/.kokoro/release/docs.cfg @@ -11,7 +11,7 @@ before_action { # doc publications use a Python image. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:12-user" } # Download trampoline resources. diff --git a/.kokoro/release/docs.sh b/.kokoro/release/docs.sh index 4c866c86..14fabc0f 100755 --- a/.kokoro/release/docs.sh +++ b/.kokoro/release/docs.sh @@ -16,7 +16,7 @@ set -eo pipefail -# build jsdocs (Python is installed on the Node 10 docker image). +# build jsdocs (Python is installed on the Node 12 docker image). if [[ -z "$CREDENTIALS" ]]; then # if CREDENTIALS are explicitly set, assume we're testing locally # and don't set NPM_CONFIG_PREFIX. diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index f249d3e4..fbc058a4 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -56,7 +56,7 @@ fi # codecov combines coverage across integration and unit tests. Include # the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=10 +COVERAGE_NODE=12 if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then NYC_BIN=./node_modules/nyc/bin/nyc.js if [ -f "$NYC_BIN" ]; then diff --git a/.kokoro/system-test.sh b/.kokoro/system-test.sh index 0a840452..87fa0653 100755 --- a/.kokoro/system-test.sh +++ b/.kokoro/system-test.sh @@ -49,7 +49,7 @@ npm run system-test # codecov combines coverage across integration and unit tests. Include # the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=10 +COVERAGE_NODE=12 if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then NYC_BIN=./node_modules/nyc/bin/nyc.js if [ -f "$NYC_BIN" ]; then diff --git a/.kokoro/test.sh b/.kokoro/test.sh index af1ce7e3..a5c7ac04 100755 --- a/.kokoro/test.sh +++ b/.kokoro/test.sh @@ -39,7 +39,7 @@ npm test # codecov combines coverage across integration and unit tests. Include # the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=10 +COVERAGE_NODE=12 if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then NYC_BIN=./node_modules/nyc/bin/nyc.js if [ -f "$NYC_BIN" ]; then diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 4d031121..5c3d9012 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -44,7 +44,7 @@ # the project root. # # Here is an example for running this script. -# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:10-user \ +# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:12-user \ # TRAMPOLINE_BUILD_FILE=.kokoro/system-test.sh \ # .kokoro/trampoline_v2.sh diff --git a/package.json b/package.json index 1e017155..c2ae7323 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "sinon": "^13.0.0", "tmp": "^0.2.0", "ts-loader": "^8.0.0", - "typescript": "^3.8.3", + "typescript": "^4.6.3", "webpack": "^5.21.2", "webpack-cli": "^4.0.0" }, From 55a5856a475494105459d755579ac4661341b7f7 Mon Sep 17 00:00:00 2001 From: Daniel Bankhead Date: Thu, 14 Apr 2022 15:08:16 -0700 Subject: [PATCH 4/6] build: Update `gts` --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5871ca41..f43a5aa0 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "chai": "^4.2.0", "codecov": "^3.0.2", "execa": "^5.0.0", - "gts": "^2.0.0", + "gts": "^3.1.0", "is-docker": "^2.0.0", "karma": "^6.0.0", "karma-chrome-launcher": "^3.0.0", From 26401ce1ed133cc1e45e2f7e5fceac6f8318f3a3 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 14 Apr 2022 22:09:47 +0000 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .github/sync-repo-settings.yaml | 2 +- .kokoro/release/docs.sh | 2 +- .kokoro/trampoline_v2.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 1b362683..d1e8b5e6 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -9,9 +9,9 @@ branchProtectionRules: - "ci/kokoro: System test" - docs - lint - - test (10) - test (12) - test (14) + - test (16) - cla/google - windows - OwlBot Post Processor diff --git a/.kokoro/release/docs.sh b/.kokoro/release/docs.sh index 14fabc0f..4c866c86 100755 --- a/.kokoro/release/docs.sh +++ b/.kokoro/release/docs.sh @@ -16,7 +16,7 @@ set -eo pipefail -# build jsdocs (Python is installed on the Node 12 docker image). +# build jsdocs (Python is installed on the Node 10 docker image). if [[ -z "$CREDENTIALS" ]]; then # if CREDENTIALS are explicitly set, assume we're testing locally # and don't set NPM_CONFIG_PREFIX. diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 5c3d9012..4d031121 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -44,7 +44,7 @@ # the project root. # # Here is an example for running this script. -# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:12-user \ +# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:10-user \ # TRAMPOLINE_BUILD_FILE=.kokoro/system-test.sh \ # .kokoro/trampoline_v2.sh From 881d74047cee25b5b1a02e51cac94e593ee23084 Mon Sep 17 00:00:00 2001 From: Daniel Bankhead Date: Thu, 14 Apr 2022 18:05:37 -0700 Subject: [PATCH 6/6] fix: type fixes --- src/auth/baseexternalclient.ts | 2 +- src/auth/computeclient.ts | 12 +++++++++--- src/auth/identitypoolclient.ts | 5 ++++- src/auth/impersonated.ts | 13 +++++++++++-- src/auth/oauth2client.ts | 19 +++++++++++++++---- src/auth/stscredentials.ts | 4 ++-- src/transporters.ts | 2 +- test/test.awsclient.ts | 18 ++++++++++++++---- test/test.externalclient.ts | 3 ++- test/test.googleauth.ts | 5 +++-- test/test.jwt.ts | 6 +++--- test/test.jwtaccess.ts | 4 ++-- test/test.refresh.ts | 6 +++--- 13 files changed, 70 insertions(+), 29 deletions(-) diff --git a/src/auth/baseexternalclient.ts b/src/auth/baseexternalclient.ts index 691e3964..bf13d368 100644 --- a/src/auth/baseexternalclient.ts +++ b/src/auth/baseexternalclient.ts @@ -247,7 +247,7 @@ export abstract class BaseExternalAccountClient extends AuthClient { * the type of external credential used. * @return A promise that resolves with the external subject token. */ - abstract async retrieveSubjectToken(): Promise; + abstract retrieveSubjectToken(): Promise; /** * @return A promise that resolves with the current GCP access token diff --git a/src/auth/computeclient.ts b/src/auth/computeclient.ts index 1bfb4d51..db91df01 100644 --- a/src/auth/computeclient.ts +++ b/src/auth/computeclient.ts @@ -73,8 +73,11 @@ export class Compute extends OAuth2Client { } data = await gcpMetadata.instance(instanceOptions); } catch (e) { - e.message = `Could not refresh access token: ${e.message}`; - this.wrapError(e); + if (e instanceof GaxiosError) { + e.message = `Could not refresh access token: ${e.message}`; + this.wrapError(e); + } + throw e; } const tokens = data as Credentials; @@ -101,7 +104,10 @@ export class Compute extends OAuth2Client { }; idToken = await gcpMetadata.instance(instanceOptions); } catch (e) { - e.message = `Could not fetch ID token: ${e.message}`; + if (e instanceof Error) { + e.message = `Could not fetch ID token: ${e.message}`; + } + throw e; } diff --git a/src/auth/identitypoolclient.ts b/src/auth/identitypoolclient.ts index eed39b1c..102025ed 100644 --- a/src/auth/identitypoolclient.ts +++ b/src/auth/identitypoolclient.ts @@ -155,7 +155,10 @@ export class IdentityPoolClient extends BaseExternalAccountClient { throw new Error(); } } catch (err) { - err.message = `The file at ${filePath} does not exist, or it is not a file. ${err.message}`; + if (err instanceof Error) { + err.message = `The file at ${filePath} does not exist, or it is not a file. ${err.message}`; + } + throw err; } diff --git a/src/auth/impersonated.ts b/src/auth/impersonated.ts index a6646095..fb1085f6 100644 --- a/src/auth/impersonated.ts +++ b/src/auth/impersonated.ts @@ -16,6 +16,7 @@ import {GetTokenResponse, OAuth2Client, RefreshOptions} from './oauth2client'; import {AuthClient} from './authclient'; +import {GaxiosError} from 'gaxios'; export interface ImpersonatedOptions extends RefreshOptions { /** @@ -132,8 +133,16 @@ export class Impersonated extends OAuth2Client { res, }; } catch (error) { - const status = error?.response?.data?.error?.status; - const message = error?.response?.data?.error?.message; + if (!(error instanceof Error)) throw error; + + let status = 0; + let message = ''; + + if (error instanceof GaxiosError) { + status = error?.response?.data?.error?.status; + message = error?.response?.data?.error?.message; + } + if (status && message) { error.message = `${status}: unable to impersonate: ${message}`; throw error; diff --git a/src/auth/oauth2client.ts b/src/auth/oauth2client.ts index 34ff13d4..de70e452 100644 --- a/src/auth/oauth2client.ts +++ b/src/auth/oauth2client.ts @@ -1155,7 +1155,10 @@ export class OAuth2Client extends AuthClient { try { res = await this.transporter.request({url}); } catch (e) { - e.message = `Failed to retrieve verification certificates: ${e.message}`; + if (e instanceof Error) { + e.message = `Failed to retrieve verification certificates: ${e.message}`; + } + throw e; } @@ -1220,7 +1223,10 @@ export class OAuth2Client extends AuthClient { try { res = await this.transporter.request({url}); } catch (e) { - e.message = `Failed to retrieve verification certificates: ${e.message}`; + if (e instanceof Error) { + e.message = `Failed to retrieve verification certificates: ${e.message}`; + } + throw e; } @@ -1271,7 +1277,10 @@ export class OAuth2Client extends AuthClient { try { envelope = JSON.parse(crypto.decodeBase64StringUtf8(segments[0])); } catch (err) { - err.message = `Can't parse token envelope: ${segments[0]}': ${err.message}`; + if (err instanceof Error) { + err.message = `Can't parse token envelope: ${segments[0]}': ${err.message}`; + } + throw err; } @@ -1282,7 +1291,9 @@ export class OAuth2Client extends AuthClient { try { payload = JSON.parse(crypto.decodeBase64StringUtf8(segments[1])); } catch (err) { - err.message = `Can't parse token payload '${segments[0]}`; + if (err instanceof Error) { + err.message = `Can't parse token payload '${segments[0]}`; + } throw err; } diff --git a/src/auth/stscredentials.ts b/src/auth/stscredentials.ts index 497b1e76..52178b82 100644 --- a/src/auth/stscredentials.ts +++ b/src/auth/stscredentials.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import {GaxiosOptions, GaxiosResponse} from 'gaxios'; +import {GaxiosError, GaxiosOptions, GaxiosResponse} from 'gaxios'; import * as querystring from 'querystring'; import {DefaultTransporter} from '../transporters'; @@ -216,7 +216,7 @@ export class StsCredentials extends OAuthClientAuthHandler { return stsSuccessfulResponse; } catch (error) { // Translate error to OAuthError. - if (error.response) { + if (error instanceof GaxiosError && error.response) { throw getErrorFromOAuthErrorResponse( error.response.data as OAuthErrorResponse, // Preserve other fields from the original error. diff --git a/src/transporters.ts b/src/transporters.ts index 3b3fded6..952f22af 100644 --- a/src/transporters.ts +++ b/src/transporters.ts @@ -104,7 +104,7 @@ export class DefaultTransporter { validate(opts); } catch (e) { if (callback) { - return callback(e); + return callback(e as Error); } else { throw e; } diff --git a/test/test.awsclient.ts b/test/test.awsclient.ts index 762e9a30..496d6599 100644 --- a/test/test.awsclient.ts +++ b/test/test.awsclient.ts @@ -408,7 +408,9 @@ describe('AwsClient', () => { {}, awsCredentialSource ); - delete missingUrlCredentialSource.url; + delete ( + missingUrlCredentialSource as Partial + ).url; const invalidOptions = { type: 'external_account', audience, @@ -435,7 +437,11 @@ describe('AwsClient', () => { {}, awsCredentialSource ); - delete missingRegionUrlCredentialSource.region_url; + delete ( + missingRegionUrlCredentialSource as Partial< + typeof awsCredentialSource + > + ).region_url; const invalidOptions = { type: 'external_account', audience, @@ -707,8 +713,12 @@ describe('AwsClient', () => { awsCredentialSource ); // Remove all optional fields. - delete requiredOnlyCredentialSource.region_url; - delete requiredOnlyCredentialSource.url; + delete ( + requiredOnlyCredentialSource as Partial + ).region_url; + delete ( + requiredOnlyCredentialSource as Partial + ).url; const requiredOnlyOptions = { type: 'external_account', audience, diff --git a/test/test.externalclient.ts b/test/test.externalclient.ts index f341d343..645ac30c 100644 --- a/test/test.externalclient.ts +++ b/test/test.externalclient.ts @@ -191,7 +191,8 @@ describe('ExternalAccountClient', () => { it('should throw when given invalid ExternalAccountClient', () => { const invalidOptions = Object.assign({}, fileSourcedOptions); - delete invalidOptions.credential_source; + delete (invalidOptions as Partial) + .credential_source; assert.throws(() => { return ExternalAccountClient.fromJSON(invalidOptions); diff --git a/test/test.googleauth.ts b/test/test.googleauth.ts index f9b601cb..ef5bc3cf 100644 --- a/test/test.googleauth.ts +++ b/test/test.googleauth.ts @@ -406,7 +406,7 @@ describe('googleauth', () => { it('fromJSON should error on missing client_email', () => { const json = createJwtJSON(); - delete json.client_email; + delete (json as Partial).client_email; assert.throws(() => { auth.fromJSON(json); }); @@ -414,7 +414,7 @@ describe('googleauth', () => { it('fromJSON should error on missing private_key', () => { const json = createJwtJSON(); - delete json.private_key; + delete (json as Partial).private_key; assert.throws(() => { auth.fromJSON(json); }); @@ -1600,6 +1600,7 @@ describe('googleauth', () => { try { await auth.getIdTokenClient('a-target-audience'); } catch (e) { + assert(e instanceof Error); assert( e.message.startsWith('Cannot fetch ID token in this environment') ); diff --git a/test/test.jwt.ts b/test/test.jwt.ts index 274fe889..6f94f281 100644 --- a/test/test.jwt.ts +++ b/test/test.jwt.ts @@ -633,7 +633,7 @@ describe('jwt', () => { it('should error on missing client_id', () => { const json = createRefreshJSON(); - delete json.client_id; + delete (json as Partial).client_id; const jwt = new JWT(); assert.throws(() => { jwt.fromJSON(json); @@ -642,7 +642,7 @@ describe('jwt', () => { it('should error on missing client_secret', () => { const json = createRefreshJSON(); - delete json.client_secret; + delete (json as Partial).client_secret; const jwt = new JWT(); assert.throws(() => { jwt.fromJSON(json); @@ -651,7 +651,7 @@ describe('jwt', () => { it('should error on missing refresh_token', () => { const json = createRefreshJSON(); - delete json.refresh_token; + delete (json as Partial).refresh_token; const jwt = new JWT(); assert.throws(() => { jwt.fromJSON(json); diff --git a/test/test.jwtaccess.ts b/test/test.jwtaccess.ts index 438e84c8..1434f256 100644 --- a/test/test.jwtaccess.ts +++ b/test/test.jwtaccess.ts @@ -128,7 +128,7 @@ describe('jwtaccess', () => { it('fromJson should error on missing client_email', () => { const j = Object.assign({}, json); - delete j.client_email; + delete (j as Partial).client_email; assert.throws(() => { client.fromJSON(j); }); @@ -136,7 +136,7 @@ describe('jwtaccess', () => { it('fromJson should error on missing private_key', () => { const j = Object.assign({}, json); - delete j.private_key; + delete (j as Partial).private_key; assert.throws(() => { client.fromJSON(j); }); diff --git a/test/test.refresh.ts b/test/test.refresh.ts index 2e06d7de..4f7b888f 100644 --- a/test/test.refresh.ts +++ b/test/test.refresh.ts @@ -55,7 +55,7 @@ describe('refresh', () => { it('fromJSON should error on missing client_id', () => { const json = createJSON(); - delete json.client_id; + delete (json as Partial).client_id; const refresh = new UserRefreshClient(); assert.throws(() => { refresh.fromJSON(json); @@ -64,7 +64,7 @@ describe('refresh', () => { it('fromJSON should error on missing client_secret', () => { const json = createJSON(); - delete json.client_secret; + delete (json as Partial).client_secret; const refresh = new UserRefreshClient(); assert.throws(() => { refresh.fromJSON(json); @@ -73,7 +73,7 @@ describe('refresh', () => { it('fromJSON should error on missing refresh_token', () => { const json = createJSON(); - delete json.refresh_token; + delete (json as Partial).refresh_token; const refresh = new UserRefreshClient(); assert.throws(() => { refresh.fromJSON(json);