From b8252a1b2c000d3717f8973e66b130735e6e4269 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 4 Oct 2024 20:18:40 +0000 Subject: [PATCH 01/29] chore: ensure we are upgrading to the latest version of image to avoid vulnerabilities Source-Link: https://github.com/googleapis/synthtool/commit/e082ba7238c3b3fce47bef3b49686def66fe5a08 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:54d3915b7c06c51f4339072d9ae9ddec43fe3197d5dd45122ca6ab7a02168765 --- .github/.OwlBot.lock.yaml | 4 +- .github/CODEOWNERS | 7 +- .github/ISSUE_TEMPLATE/bug_report.yml | 99 +++++++++++++++++++ .../ISSUE_TEMPLATE/documentation_request.yml | 53 ++++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 53 ++++++++++ .github/ISSUE_TEMPLATE/processs_request.md | 4 + .github/ISSUE_TEMPLATE/questions.md | 8 ++ .github/auto-approve.yml | 4 +- .github/scripts/close-invalid-link.cjs | 56 +++++++++++ .github/scripts/close-unresponsive.cjs | 69 +++++++++++++ .github/scripts/remove-response-label.cjs | 33 +++++++ .github/workflows/ci.yaml | 24 ++--- .github/workflows/issues-no-repro.yaml | 18 ++++ .github/workflows/response.yaml | 35 +++++++ .kokoro/common.cfg | 2 +- .kokoro/continuous/node18/common.cfg | 24 +++++ .kokoro/continuous/node18/lint.cfg | 4 + .kokoro/continuous/node18/samples-test.cfg | 12 +++ .kokoro/continuous/node18/system-test.cfg | 12 +++ .kokoro/continuous/node18/test.cfg | 0 .kokoro/presubmit/node18/common.cfg | 24 +++++ .kokoro/presubmit/node18/samples-test.cfg | 12 +++ .kokoro/presubmit/node18/system-test.cfg | 12 +++ .kokoro/presubmit/node18/test.cfg | 0 .kokoro/release/docs-devsite.cfg | 2 +- .kokoro/release/docs.cfg | 2 +- .kokoro/release/docs.sh | 2 +- .kokoro/release/publish.cfg | 2 +- .kokoro/samples-test.sh | 2 +- .kokoro/system-test.sh | 2 +- .kokoro/test.bat | 2 +- .kokoro/test.sh | 2 +- .kokoro/trampoline_v2.sh | 2 +- README.md | 2 +- 34 files changed, 556 insertions(+), 33 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/documentation_request.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/ISSUE_TEMPLATE/processs_request.md create mode 100644 .github/ISSUE_TEMPLATE/questions.md create mode 100644 .github/scripts/close-invalid-link.cjs create mode 100644 .github/scripts/close-unresponsive.cjs create mode 100644 .github/scripts/remove-response-label.cjs create mode 100644 .github/workflows/issues-no-repro.yaml create mode 100644 .github/workflows/response.yaml create mode 100644 .kokoro/continuous/node18/common.cfg create mode 100644 .kokoro/continuous/node18/lint.cfg create mode 100644 .kokoro/continuous/node18/samples-test.cfg create mode 100644 .kokoro/continuous/node18/system-test.cfg create mode 100644 .kokoro/continuous/node18/test.cfg create mode 100644 .kokoro/presubmit/node18/common.cfg create mode 100644 .kokoro/presubmit/node18/samples-test.cfg create mode 100644 .kokoro/presubmit/node18/system-test.cfg create mode 100644 .kokoro/presubmit/node18/test.cfg diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 9e90d54..7863beb 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest - digest: sha256:d920257482ca1cd72978f29f7d28765a9f8c758c21ee0708234db5cf4c5016c2 -# created: 2024-06-12T16:18:41.688792375Z + digest: sha256:54d3915b7c06c51f4339072d9ae9ddec43fe3197d5dd45122ca6ab7a02168765 +# created: 2024-10-04T20:16:11.598831243Z diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 80520bb..8b7632f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,8 +5,5 @@ # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax -# The yoshi-nodejs team is the default owner for nodejs repositories. -* @googleapis/yoshi-nodejs - -# The github automation team is the default owner for the auto-approve file. -.github/auto-approve.yml @googleapis/github-automation +# Unless specified, the jsteam is the default owner for nodejs repositories. +* @googleapis/jsteam \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..b4bef80 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,99 @@ +name: Bug Report +description: Create a report to help us improve +labels: + - bug +body: + - type: markdown + attributes: + value: > + **PLEASE READ**: If you have a support contract with Google, please + create an issue in the [support + console](https://cloud.google.com/support/) instead of filing on GitHub. + This will ensure a timely response. Otherwise, please make sure to + follow the steps below. + - type: checkboxes + attributes: + label: Please make sure you have searched for information in the following + guides. + options: + - label: "Search the issues already opened: + https://github.com/GoogleCloudPlatform/google-cloud-node/issues" + required: true + - label: "Search StackOverflow: + http://stackoverflow.com/questions/tagged/google-cloud-platform+nod\ + e.js" + required: true + - label: "Check our Troubleshooting guide: + https://github.com/googleapis/google-cloud-node/blob/main/docs/trou\ + bleshooting.md" + required: true + - label: "Check our FAQ: + https://github.com/googleapis/google-cloud-node/blob/main/docs/faq.\ + md" + required: true + - label: "Check our libraries HOW-TO: + https://github.com/googleapis/gax-nodejs/blob/main/client-libraries\ + .md" + required: true + - label: "Check out our authentication guide: + https://github.com/googleapis/google-auth-library-nodejs" + required: true + - label: "Check out handwritten samples for many of our APIs: + https://github.com/GoogleCloudPlatform/nodejs-docs-samples" + required: true + - type: textarea + attributes: + label: > + A screenshot that you have tested with "Try this API". + description: > + As our client libraries are mostly autogenerated, we kindly request + that you test whether your issue is with the client library, or with the + API itself. To do so, please search for your API + here: https://developers.google.com/apis-explorer and attempt to + reproduce the issue in the given method. Please include a screenshot of + the response in "Try this API". This response should NOT match the current + behavior you are experiencing. If the behavior is the same, it means + that you are likely experiencing a bug with the API itself. In that + case, please submit an issue to the API team, either by submitting an + issue in its issue tracker (https://cloud.google.com/support/docs/issue-trackers), or by + submitting an issue in its linked tracker in the .repo-metadata.json + file https://github.com/googleapis/gcp-metadata/issues + validations: + required: true + - type: input + attributes: + label: > + Link to the code that reproduces this issue. A link to a **public** Github Repository or gist with a minimal + reproduction. + description: > + **Skipping this or providing an invalid link will result in the issue being closed** + validations: + required: true + - type: textarea + attributes: + label: > + A step-by-step description of how to reproduce the issue, based on + the linked reproduction. + description: > + Screenshots can be provided in the issue body below. + placeholder: | + 1. Start the application in development (next dev) + 2. Click X + 3. Y will happen + validations: + required: true + - type: textarea + attributes: + label: A clear and concise description of what the bug is, and what you + expected to happen. + placeholder: Following the steps from the previous section, I expected A to + happen, but I observed B instead + validations: + required: true + + - type: textarea + attributes: + label: A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. ** + placeholder: 'Documentation here(link) states that B should happen instead of A' + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/documentation_request.yml b/.github/ISSUE_TEMPLATE/documentation_request.yml new file mode 100644 index 0000000..39a4eee --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation_request.yml @@ -0,0 +1,53 @@ +name: Documentation Requests +description: Requests for more information +body: + - type: markdown + attributes: + value: > + Please use this issue type to log documentation requests against the library itself. + These requests should involve documentation on Github (`.md` files), and should relate to the library + itself. If you have questions or documentation requests for an API, please + reach out to the API tracker itself. + + Please submit an issue to the API team, either by submitting an + issue in its issue tracker https://cloud.google.com/support/docs/issue-trackers), or by + submitting an issue in its linked tracker in the .repo-metadata.json + file in the API under packages/* ([example](https://github.com/googleapis/gcp-metadata/issues)). + You can also submit a request to documentation on cloud.google.com itself with the "Send Feedback" + on the bottom of the page. + + + Please note that documentation requests and questions for specific APIs + will be closed. + - type: checkboxes + attributes: + label: Please make sure you have searched for information in the following + guides. + options: + - label: "Search the issues already opened: + https://github.com/GoogleCloudPlatform/google-cloud-node/issues" + required: true + - label: "Check our Troubleshooting guide: + https://googlecloudplatform.github.io/google-cloud-node/#/docs/guid\ + es/troubleshooting" + required: true + - label: "Check our FAQ: + https://googlecloudplatform.github.io/google-cloud-node/#/docs/guid\ + es/faq" + required: true + - label: "Check our libraries HOW-TO: + https://github.com/googleapis/gax-nodejs/blob/main/client-libraries\ + .md" + required: true + - label: "Check out our authentication guide: + https://github.com/googleapis/google-auth-library-nodejs" + required: true + - label: "Check out handwritten samples for many of our APIs: + https://github.com/GoogleCloudPlatform/nodejs-docs-samples" + required: true + - type: textarea + attributes: + label: > + Documentation Request + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..8e60c73 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,53 @@ +name: Feature Request +description: Suggest an idea for this library +labels: + - feature request +body: + - type: markdown + attributes: + value: > + **PLEASE READ**: If you have a support contract with Google, please + create an issue in the [support + console](https://cloud.google.com/support/) instead of filing on GitHub. + This will ensure a timely response. Otherwise, please make sure to + follow the steps below. + - type: textarea + attributes: + label: > + A screenshot that you have tested with "Try this API". + description: > + As our client libraries are mostly autogenerated, we kindly request + that you test whether your feature request is with the client library, or with the + API itself. To do so, please search for your API + here: https://developers.google.com/apis-explorer and attempt to + reproduce the issue in the given method. Please include a screenshot of + the response in "Try this API". This response should NOT match the current + behavior you are experiencing. If the behavior is the same, it means + that you are likely requesting a feature for the API itself. In that + case, please submit an issue to the API team, either by submitting an + issue in its issue tracker https://cloud.google.com/support/docs/issue-trackers, or by + submitting an issue in its linked tracker in the .repo-metadata.json + file in the API under packages/* ([example](https://github.com/googleapis/gcp-metadata/issues)) + + Example of library specific issues would be: retry strategies, authentication questions, or issues with typings. + Examples of API issues would include: expanding method parameter types, adding functionality to an API. + validations: + required: true + - type: textarea + attributes: + label: > + What would you like to see in the library? + description: > + Screenshots can be provided in the issue body below. + placeholder: | + 1. Set up authentication like so + 2. Run the program like so + 3. X would be nice to happen + + - type: textarea + attributes: + label: Describe alternatives you've considered + + - type: textarea + attributes: + label: Additional context/notes \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/processs_request.md b/.github/ISSUE_TEMPLATE/processs_request.md new file mode 100644 index 0000000..45682e8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/processs_request.md @@ -0,0 +1,4 @@ +--- +name: Process Request +about: Submit a process request to the library. Process requests are any requests related to library infrastructure, for example CI/CD, publishing, releasing, broken links. +--- diff --git a/.github/ISSUE_TEMPLATE/questions.md b/.github/ISSUE_TEMPLATE/questions.md new file mode 100644 index 0000000..62c1dd1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/questions.md @@ -0,0 +1,8 @@ +--- +name: Question +about: If you have a question, please use Discussions + +--- + +If you have a general question that goes beyond the library itself, we encourage you to use [Discussions](https://github.com//discussions) +to engage with fellow community members! diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml index ec51b07..7cba0af 100644 --- a/.github/auto-approve.yml +++ b/.github/auto-approve.yml @@ -1,4 +1,2 @@ processes: - - "NodeDependency" - - "OwlBotTemplateChangesNode" - - "OwlBotPRsNode" \ No newline at end of file + - "NodeDependency" \ No newline at end of file diff --git a/.github/scripts/close-invalid-link.cjs b/.github/scripts/close-invalid-link.cjs new file mode 100644 index 0000000..d7a3688 --- /dev/null +++ b/.github/scripts/close-invalid-link.cjs @@ -0,0 +1,56 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +async function closeIssue(github, owner, repo, number) { + await github.rest.issues.createComment({ + owner: owner, + repo: repo, + issue_number: number, + body: 'Issue was opened with an invalid reproduction link. Please make sure the repository is a valid, publicly-accessible github repository, and make sure the url is complete (example: https://github.com/googleapis/google-cloud-node)' + }); + await github.rest.issues.update({ + owner: owner, + repo: repo, + issue_number: number, + state: 'closed' + }); +} +module.exports = async ({github, context}) => { + const owner = context.repo.owner; + const repo = context.repo.repo; + const number = context.issue.number; + + const issue = await github.rest.issues.get({ + owner: owner, + repo: repo, + issue_number: number, + }); + + const isBugTemplate = issue.data.body.includes('Link to the code that reproduces this issue'); + + if (isBugTemplate) { + console.log(`Issue ${number} is a bug template`) + try { + const link = issue.data.body.split('\n')[18].match(/(https?:\/\/(gist\.)?github.com\/.*)/)[0]; + console.log(`Issue ${number} contains this link: ${link}`) + const isValidLink = (await fetch(link)).ok; + console.log(`Issue ${number} has a ${isValidLink ? 'valid' : 'invalid'} link`) + if (!isValidLink) { + await closeIssue(github, owner, repo, number); + } + } catch (err) { + await closeIssue(github, owner, repo, number); + } + } +}; diff --git a/.github/scripts/close-unresponsive.cjs b/.github/scripts/close-unresponsive.cjs new file mode 100644 index 0000000..142dc12 --- /dev/null +++ b/.github/scripts/close-unresponsive.cjs @@ -0,0 +1,69 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +function labeledEvent(data) { + return data.event === 'labeled' && data.label.name === 'needs more info'; + } + + const numberOfDaysLimit = 15; + const close_message = `This has been closed since a request for information has \ + not been answered for ${numberOfDaysLimit} days. It can be reopened when the \ + requested information is provided.`; + + module.exports = async ({github, context}) => { + const owner = context.repo.owner; + const repo = context.repo.repo; + + const issues = await github.rest.issues.listForRepo({ + owner: owner, + repo: repo, + labels: 'needs more info', + }); + const numbers = issues.data.map((e) => e.number); + + for (const number of numbers) { + const events = await github.paginate( + github.rest.issues.listEventsForTimeline, + { + owner: owner, + repo: repo, + issue_number: number, + }, + (response) => response.data.filter(labeledEvent) + ); + + const latest_response_label = events[events.length - 1]; + + const created_at = new Date(latest_response_label.created_at); + const now = new Date(); + const diff = now - created_at; + const diffDays = diff / (1000 * 60 * 60 * 24); + + if (diffDays > numberOfDaysLimit) { + await github.rest.issues.update({ + owner: owner, + repo: repo, + issue_number: number, + state: 'closed', + }); + + await github.rest.issues.createComment({ + owner: owner, + repo: repo, + issue_number: number, + body: close_message, + }); + } + } + }; diff --git a/.github/scripts/remove-response-label.cjs b/.github/scripts/remove-response-label.cjs new file mode 100644 index 0000000..887cf34 --- /dev/null +++ b/.github/scripts/remove-response-label.cjs @@ -0,0 +1,33 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +module.exports = async ({ github, context }) => { + const commenter = context.actor; + const issue = await github.rest.issues.get({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + const author = issue.data.user.login; + const labels = issue.data.labels.map((e) => e.name); + + if (author === commenter && labels.includes('needs more info')) { + await github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + name: 'needs more info', + }); + } + }; diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4892eb2..9901e14 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,10 +9,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [14, 16, 18, 20] + node: [14, 16, 18}] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - run: node --version @@ -29,10 +29,10 @@ jobs: windows: runs-on: windows-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 14 + node-version: 18 - run: npm install --engine-strict - run: npm test env: @@ -40,19 +40,19 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 14 + node-version: 18 - run: npm install - run: npm run lint docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 14 + node-version: 18 - run: npm install - run: npm run docs - uses: JustinBeckwith/linkinator-action@v1 diff --git a/.github/workflows/issues-no-repro.yaml b/.github/workflows/issues-no-repro.yaml new file mode 100644 index 0000000..442a46b --- /dev/null +++ b/.github/workflows/issues-no-repro.yaml @@ -0,0 +1,18 @@ +name: invalid_link +on: + issues: + types: [opened, reopened] + +jobs: + close: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + - uses: actions/github-script@v7 + with: + script: | + const script = require('./.github/scripts/close-invalid-link.cjs') + await script({github, context}) diff --git a/.github/workflows/response.yaml b/.github/workflows/response.yaml new file mode 100644 index 0000000..6ed3732 --- /dev/null +++ b/.github/workflows/response.yaml @@ -0,0 +1,35 @@ +name: no_response +on: + schedule: + - cron: '30 1 * * *' # Run every day at 01:30 + workflow_dispatch: + issue_comment: + +jobs: + close: + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + - uses: actions/github-script@v7 + with: + script: | + const script = require('./.github/scripts/close-unresponsive.cjs') + await script({github, context}) + + remove_label: + if: github.event_name == 'issue_comment' + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + - uses: actions/github-script@v7 + with: + script: | + const script = require('./.github/scripts/remove-response-label.cjs') + await script({github, context}) diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg index 4207c90..6ac7f05 100644 --- a/.kokoro/common.cfg +++ b/.kokoro/common.cfg @@ -16,7 +16,7 @@ build_file: "gcp-metadata/.kokoro/trampoline_v2.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:18-user" } env_vars: { key: "TRAMPOLINE_BUILD_FILE" diff --git a/.kokoro/continuous/node18/common.cfg b/.kokoro/continuous/node18/common.cfg new file mode 100644 index 0000000..6ac7f05 --- /dev/null +++ b/.kokoro/continuous/node18/common.cfg @@ -0,0 +1,24 @@ +# 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: "gcp-metadata/.kokoro/trampoline_v2.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:18-user" +} +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/gcp-metadata/.kokoro/test.sh" +} diff --git a/.kokoro/continuous/node18/lint.cfg b/.kokoro/continuous/node18/lint.cfg new file mode 100644 index 0000000..e2a887a --- /dev/null +++ b/.kokoro/continuous/node18/lint.cfg @@ -0,0 +1,4 @@ +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/gcp-metadata/.kokoro/lint.sh" +} diff --git a/.kokoro/continuous/node18/samples-test.cfg b/.kokoro/continuous/node18/samples-test.cfg new file mode 100644 index 0000000..3253b8a --- /dev/null +++ b/.kokoro/continuous/node18/samples-test.cfg @@ -0,0 +1,12 @@ +# Download resources for system tests (service account key, etc.) +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/gcp-metadata/.kokoro/samples-test.sh" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "long-door-651-kokoro-system-test-service-account" +} \ No newline at end of file diff --git a/.kokoro/continuous/node18/system-test.cfg b/.kokoro/continuous/node18/system-test.cfg new file mode 100644 index 0000000..24ea33e --- /dev/null +++ b/.kokoro/continuous/node18/system-test.cfg @@ -0,0 +1,12 @@ +# Download resources for system tests (service account key, etc.) +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/gcp-metadata/.kokoro/system-test.sh" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "long-door-651-kokoro-system-test-service-account" +} \ No newline at end of file diff --git a/.kokoro/continuous/node18/test.cfg b/.kokoro/continuous/node18/test.cfg new file mode 100644 index 0000000..e69de29 diff --git a/.kokoro/presubmit/node18/common.cfg b/.kokoro/presubmit/node18/common.cfg new file mode 100644 index 0000000..6ac7f05 --- /dev/null +++ b/.kokoro/presubmit/node18/common.cfg @@ -0,0 +1,24 @@ +# 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: "gcp-metadata/.kokoro/trampoline_v2.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:18-user" +} +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/gcp-metadata/.kokoro/test.sh" +} diff --git a/.kokoro/presubmit/node18/samples-test.cfg b/.kokoro/presubmit/node18/samples-test.cfg new file mode 100644 index 0000000..3253b8a --- /dev/null +++ b/.kokoro/presubmit/node18/samples-test.cfg @@ -0,0 +1,12 @@ +# Download resources for system tests (service account key, etc.) +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/gcp-metadata/.kokoro/samples-test.sh" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "long-door-651-kokoro-system-test-service-account" +} \ No newline at end of file diff --git a/.kokoro/presubmit/node18/system-test.cfg b/.kokoro/presubmit/node18/system-test.cfg new file mode 100644 index 0000000..24ea33e --- /dev/null +++ b/.kokoro/presubmit/node18/system-test.cfg @@ -0,0 +1,12 @@ +# Download resources for system tests (service account key, etc.) +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/gcp-metadata/.kokoro/system-test.sh" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "long-door-651-kokoro-system-test-service-account" +} \ No newline at end of file diff --git a/.kokoro/presubmit/node18/test.cfg b/.kokoro/presubmit/node18/test.cfg new file mode 100644 index 0000000..e69de29 diff --git a/.kokoro/release/docs-devsite.cfg b/.kokoro/release/docs-devsite.cfg index 3ce6bbc..2bee988 100644 --- a/.kokoro/release/docs-devsite.cfg +++ b/.kokoro/release/docs-devsite.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:14-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:18-user" } # Download trampoline resources. diff --git a/.kokoro/release/docs.cfg b/.kokoro/release/docs.cfg index c72d89c..2e6da58 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:14-user" + value: "gcr.io/cloud-devrel-kokoro-resources/node:18-user" } # Download trampoline resources. diff --git a/.kokoro/release/docs.sh b/.kokoro/release/docs.sh index 1d8f3f4..e9079a6 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 18 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/release/publish.cfg b/.kokoro/release/publish.cfg index 1c0dc3a..de86e8c 100644 --- a/.kokoro/release/publish.cfg +++ b/.kokoro/release/publish.cfg @@ -30,7 +30,7 @@ build_file: "gcp-metadata/.kokoro/trampoline_v2.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:18-user" } env_vars: { diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index 8c5d108..c1cb0fc 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=14 +COVERAGE_NODE=18 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 0b3043d..a90d5cf 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=14 +COVERAGE_NODE=18 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.bat b/.kokoro/test.bat index 0bb1240..caf8256 100644 --- a/.kokoro/test.bat +++ b/.kokoro/test.bat @@ -21,7 +21,7 @@ cd .. @rem we upgrade Node.js in the image: SET PATH=%PATH%;/cygdrive/c/Program Files/nodejs/npm -call nvm use v14.17.3 +call nvm use 18 call which node call npm install || goto :error diff --git a/.kokoro/test.sh b/.kokoro/test.sh index 862d478..0d9f639 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=14 +COVERAGE_NODE=18 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 4d03112..5d6cfcc 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:18-user \ # TRAMPOLINE_BUILD_FILE=.kokoro/system-test.sh \ # .kokoro/trampoline_v2.sh diff --git a/README.md b/README.md index fd93aea..d0c1b9d 100644 --- a/README.md +++ b/README.md @@ -232,4 +232,4 @@ See [LICENSE](https://github.com/googleapis/gcp-metadata/blob/main/LICENSE) [projects]: https://console.cloud.google.com/project [billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[auth]: https://cloud.google.com/docs/authentication/getting-started +[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local From a17d36c923e9acf0d24f94470cfa68f79c2802eb Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Thu, 7 Nov 2024 17:20:34 -0800 Subject: [PATCH 02/29] chore: complete migrating to node 18 --- .kokoro/continuous/node14/common.cfg | 24 ------------- .kokoro/continuous/node14/lint.cfg | 4 --- .kokoro/continuous/node14/samples-test.cfg | 12 ------- .kokoro/continuous/node14/system-test.cfg | 12 ------- .kokoro/continuous/node14/test.cfg | 0 .kokoro/presubmit/node14/common.cfg | 24 ------------- .kokoro/presubmit/node14/samples-test.cfg | 12 ------- .kokoro/presubmit/node14/system-test.cfg | 12 ------- .kokoro/presubmit/node14/test.cfg | 0 owlbot.py | 2 +- package.json | 42 +++++++++++----------- samples/package.json | 4 +-- 12 files changed, 25 insertions(+), 123 deletions(-) delete mode 100644 .kokoro/continuous/node14/common.cfg delete mode 100644 .kokoro/continuous/node14/lint.cfg delete mode 100644 .kokoro/continuous/node14/samples-test.cfg delete mode 100644 .kokoro/continuous/node14/system-test.cfg delete mode 100644 .kokoro/continuous/node14/test.cfg delete mode 100644 .kokoro/presubmit/node14/common.cfg delete mode 100644 .kokoro/presubmit/node14/samples-test.cfg delete mode 100644 .kokoro/presubmit/node14/system-test.cfg delete mode 100644 .kokoro/presubmit/node14/test.cfg diff --git a/.kokoro/continuous/node14/common.cfg b/.kokoro/continuous/node14/common.cfg deleted file mode 100644 index 4207c90..0000000 --- a/.kokoro/continuous/node14/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: "gcp-metadata/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gcp-metadata/.kokoro/test.sh" -} diff --git a/.kokoro/continuous/node14/lint.cfg b/.kokoro/continuous/node14/lint.cfg deleted file mode 100644 index e2a887a..0000000 --- a/.kokoro/continuous/node14/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gcp-metadata/.kokoro/lint.sh" -} diff --git a/.kokoro/continuous/node14/samples-test.cfg b/.kokoro/continuous/node14/samples-test.cfg deleted file mode 100644 index 3253b8a..0000000 --- a/.kokoro/continuous/node14/samples-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" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gcp-metadata/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/.kokoro/continuous/node14/system-test.cfg b/.kokoro/continuous/node14/system-test.cfg deleted file mode 100644 index 24ea33e..0000000 --- a/.kokoro/continuous/node14/system-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" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gcp-metadata/.kokoro/system-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/.kokoro/continuous/node14/test.cfg b/.kokoro/continuous/node14/test.cfg deleted file mode 100644 index e69de29..0000000 diff --git a/.kokoro/presubmit/node14/common.cfg b/.kokoro/presubmit/node14/common.cfg deleted file mode 100644 index 4207c90..0000000 --- a/.kokoro/presubmit/node14/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: "gcp-metadata/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:14-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gcp-metadata/.kokoro/test.sh" -} diff --git a/.kokoro/presubmit/node14/samples-test.cfg b/.kokoro/presubmit/node14/samples-test.cfg deleted file mode 100644 index 3253b8a..0000000 --- a/.kokoro/presubmit/node14/samples-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" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gcp-metadata/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/.kokoro/presubmit/node14/system-test.cfg b/.kokoro/presubmit/node14/system-test.cfg deleted file mode 100644 index 24ea33e..0000000 --- a/.kokoro/presubmit/node14/system-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" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/gcp-metadata/.kokoro/system-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/.kokoro/presubmit/node14/test.cfg b/.kokoro/presubmit/node14/test.cfg deleted file mode 100644 index e69de29..0000000 diff --git a/owlbot.py b/owlbot.py index d3bfc21..8ae05ad 100644 --- a/owlbot.py +++ b/owlbot.py @@ -6,4 +6,4 @@ common_templates = gcp.CommonTemplates() templates = common_templates.node_library() -s.copy(sources=templates, excludes=[".github/ISSUE_TEMPLATE", ".github/scripts", ".github/workflows/issues-no-repro.yaml"]) +s.copy(sources=templates, excludes=[".github/ISSUE_TEMPLATE/", ".github/scripts/", ".github/workflows/issues-no-repro.yaml"]) diff --git a/package.json b/package.json index 854bfff..73e80d1 100644 --- a/package.json +++ b/package.json @@ -41,32 +41,34 @@ "json-bigint": "^1.0.0" }, "devDependencies": { - "@google-cloud/functions": "^3.0.0", - "@types/json-bigint": "^1.0.0", - "@types/mocha": "^9.0.0", - "@types/ncp": "^2.0.1", - "@types/node": "^20.0.0", - "@types/sinon": "^17.0.0", + "@google-cloud/functions": "^3.6.0", + "@types/json-bigint": "^1.0.4", + "@types/mocha": "^9.1.1", + "@types/ncp": "^2.0.8", + "@types/node": "^20.17.6", + "@types/sinon": "^17.0.3", "@types/tmp": "0.2.6", - "@types/uuid": "^9.0.0", - "c8": "^9.0.0", + "@types/uuid": "^9.0.8", + "c8": "^9.1.0", "cross-env": "^7.0.3", - "gcbuild": "^1.3.4", - "gcx": "^1.0.0", - "gts": "^5.0.0", - "linkinator": "^3.0.0", - "jsdoc": "^4.0.0", + "gaxios": "^6.7.1", + "gcbuild": "^1.3.39", + "gcx": "^1.1.36", + "gts": "^6.0.2", + "jsdoc": "^4.0.4", "jsdoc-fresh": "^3.0.0", "jsdoc-region-tag": "^3.0.0", - "mocha": "^8.0.0", + "json-bigint": "^1.0.0", + "linkinator": "^3.1.0", + "mocha": "^8.4.0", "ncp": "^2.0.0", - "nock": "^13.0.0", - "sinon": "^17.0.0", - "tmp": "^0.2.0", - "typescript": "^5.1.6", - "uuid": "^9.0.0" + "nock": "^13.5.5", + "sinon": "^17.0.1", + "tmp": "^0.2.3", + "typescript": "^5.6.3", + "uuid": "^9.0.1" }, "engines": { - "node": ">=14" + "node": ">=18" } } diff --git a/samples/package.json b/samples/package.json index ea9a819..68da64d 100644 --- a/samples/package.json +++ b/samples/package.json @@ -3,7 +3,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=14" + "node": ">=18" }, "files": [ "*.js" @@ -20,4 +20,4 @@ "chai": "^4.2.0", "mocha": "^8.0.0" } -} +} \ No newline at end of file From de6b2d01b1375a3fa66dbb69a577faebc7123b32 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 8 Nov 2024 01:22:38 +0000 Subject: [PATCH 03/29] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-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 | 4 ++-- .github/workflows/ci.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index b46e4c4..a013376 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -8,9 +8,9 @@ branchProtectionRules: - "ci/kokoro: Samples test" - "ci/kokoro: System test" - lint - - test (14) - - test (16) - test (18) + - test (20) + - test (22) - cla/google - windows - OwlBot Post Processor diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9901e14..d3ecae9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [14, 16, 18}] + node: [18, 20, 22}] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From 032da76b52eb43330fd143fc86c9ab67da4a7f8c Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Thu, 7 Nov 2024 17:34:24 -0800 Subject: [PATCH 04/29] update all dependencies to newest version --- package.json | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 73e80d1..2b15321 100644 --- a/package.json +++ b/package.json @@ -36,37 +36,33 @@ ], "author": "Google LLC", "license": "Apache-2.0", - "dependencies": { - "gaxios": "^6.1.1", - "json-bigint": "^1.0.0" - }, "devDependencies": { "@google-cloud/functions": "^3.6.0", "@types/json-bigint": "^1.0.4", - "@types/mocha": "^9.1.1", + "@types/mocha": "^10.0.9", "@types/ncp": "^2.0.8", - "@types/node": "^20.17.6", + "@types/node": "^22.9.0", "@types/sinon": "^17.0.3", - "@types/tmp": "0.2.6", - "@types/uuid": "^9.0.8", - "c8": "^9.1.0", + "@types/tmp": "^0.2.6", + "@types/uuid": "^10.0.0", + "c8": "^10.1.2", "cross-env": "^7.0.3", "gaxios": "^6.7.1", "gcbuild": "^1.3.39", - "gcx": "^1.1.36", + "gcx": "^2.0.27", "gts": "^6.0.2", "jsdoc": "^4.0.4", "jsdoc-fresh": "^3.0.0", "jsdoc-region-tag": "^3.0.0", "json-bigint": "^1.0.0", - "linkinator": "^3.1.0", - "mocha": "^8.4.0", + "linkinator": "^6.1.2", + "mocha": "^10.8.2", "ncp": "^2.0.0", "nock": "^13.5.5", - "sinon": "^17.0.1", + "sinon": "^19.0.2", "tmp": "^0.2.3", "typescript": "^5.6.3", - "uuid": "^9.0.1" + "uuid": "^11.0.2" }, "engines": { "node": ">=18" From bd03d16393b09e7fdf973aaff776b59f9132268b Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 12 Nov 2024 12:10:44 -0800 Subject: [PATCH 05/29] add any typings --- system-test/any.d.ts | 1 + test/any.d.ts | 1 + 2 files changed, 2 insertions(+) create mode 100644 system-test/any.d.ts create mode 100644 test/any.d.ts diff --git a/system-test/any.d.ts b/system-test/any.d.ts new file mode 100644 index 0000000..c610914 --- /dev/null +++ b/system-test/any.d.ts @@ -0,0 +1 @@ +declare module '*'; diff --git a/test/any.d.ts b/test/any.d.ts new file mode 100644 index 0000000..c610914 --- /dev/null +++ b/test/any.d.ts @@ -0,0 +1 @@ +declare module '*'; From 4d75b307dd90c24142f18e369cbb7ccc6981d387 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 12 Nov 2024 12:12:30 -0800 Subject: [PATCH 06/29] fix broken test --- test/any.d.ts | 1 - tsconfig.json | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 test/any.d.ts diff --git a/test/any.d.ts b/test/any.d.ts deleted file mode 100644 index c610914..0000000 --- a/test/any.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module '*'; diff --git a/tsconfig.json b/tsconfig.json index b7492c4..cc54f42 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,8 @@ "include": [ "src/*.ts", "test/*.ts", - "system-test/*.ts" + "system-test/*.ts", + "test/**/*.ts" ], "exclude": [ "test/fixtures" From 6feb71d4a37ff609d917bcdd9b964c543a2d39f5 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 12:22:06 -0800 Subject: [PATCH 07/29] Update samples-test.sh --- .kokoro/samples-test.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index c1cb0fc..c75e15f 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +npm i -g npm@10 + set -eo pipefail export NPM_CONFIG_PREFIX=${HOME}/.npm-global From a84f41591912965b30db281edc6143f9e5fe2002 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 12 Nov 2024 20:24:02 +0000 Subject: [PATCH 08/29] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-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 --- .kokoro/samples-test.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index c75e15f..c1cb0fc 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -npm i -g npm@10 - set -eo pipefail export NPM_CONFIG_PREFIX=${HOME}/.npm-global From 362d21af3124b9cc48545cfe0eb064a03464e2ed Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 12:52:10 -0800 Subject: [PATCH 09/29] Update samples-test.sh --- .kokoro/samples-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index c1cb0fc..7ece144 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -16,7 +16,7 @@ set -eo pipefail -export NPM_CONFIG_PREFIX=${HOME}/.npm-global +# export NPM_CONFIG_PREFIX=${HOME}/.npm-global # Setup service account credentials. export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account From 6170f9e8e1dd02686e94c001d7283540a93a2345 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 12:52:32 -0800 Subject: [PATCH 10/29] Update owlbot.py --- owlbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/owlbot.py b/owlbot.py index 8ae05ad..3ec0e49 100644 --- a/owlbot.py +++ b/owlbot.py @@ -6,4 +6,4 @@ common_templates = gcp.CommonTemplates() templates = common_templates.node_library() -s.copy(sources=templates, excludes=[".github/ISSUE_TEMPLATE/", ".github/scripts/", ".github/workflows/issues-no-repro.yaml"]) +s.copy(sources=templates, excludes=[".github/ISSUE_TEMPLATE/", ".github/scripts/", ".github/workflows/issues-no-repro.yaml", ".kokoro/samples-test.sh"]) From 9b6a68b73a36be871ab670b76d310ccd710e5a6f Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 12 Nov 2024 20:54:12 +0000 Subject: [PATCH 11/29] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-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 --- .kokoro/samples-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index 7ece144..c1cb0fc 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -16,7 +16,7 @@ set -eo pipefail -# export NPM_CONFIG_PREFIX=${HOME}/.npm-global +export NPM_CONFIG_PREFIX=${HOME}/.npm-global # Setup service account credentials. export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account From cbdc877bddf20b7190a5a56a08976e8d2e7094cf Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:01:03 -0800 Subject: [PATCH 12/29] Update owlbot.py --- owlbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/owlbot.py b/owlbot.py index 3ec0e49..408fc81 100644 --- a/owlbot.py +++ b/owlbot.py @@ -6,4 +6,4 @@ common_templates = gcp.CommonTemplates() templates = common_templates.node_library() -s.copy(sources=templates, excludes=[".github/ISSUE_TEMPLATE/", ".github/scripts/", ".github/workflows/issues-no-repro.yaml", ".kokoro/samples-test.sh"]) +s.copy(sources=templates, excludes=[".github/ISSUE_TEMPLATE", ".github/scripts", ".github/workflows/issues-no-repro.yaml", ".kokoro/samples-test.sh"]) From c4f05a93f098c7e3d415eb9bf348bfb88120b564 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:01:31 -0800 Subject: [PATCH 13/29] Update samples-test.sh --- .kokoro/samples-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index c1cb0fc..7ece144 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -16,7 +16,7 @@ set -eo pipefail -export NPM_CONFIG_PREFIX=${HOME}/.npm-global +# export NPM_CONFIG_PREFIX=${HOME}/.npm-global # Setup service account credentials. export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account From 96731390af57b99fb4e91f87bde1ad4051bd58d8 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:09:58 -0800 Subject: [PATCH 14/29] Update samples-test.sh --- .kokoro/samples-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index 7ece144..dc444f4 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -16,7 +16,7 @@ set -eo pipefail -# export NPM_CONFIG_PREFIX=${HOME}/.npm-global +export NPM_CONFIG_PREFIX=/home/node/.npm-global # Setup service account credentials. export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account From facc6f7de1f45b37275214777c4fd5fa42f3ca96 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:09:59 -0800 Subject: [PATCH 15/29] Update samples-test.sh --- .kokoro/samples-test.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index dc444f4..b7e2f22 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -16,7 +16,10 @@ set -eo pipefail -export NPM_CONFIG_PREFIX=/home/node/.npm-global +# export NPM_CONFIG_PREFIX=/home/node/.npm-global + +echo $(npm -v) +echo $(which npm) # Setup service account credentials. export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account From b8ecf14a3b2c6c99ec474312b9cc790f3cbbfa8a Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:24:00 -0800 Subject: [PATCH 16/29] Update samples-test.sh --- .kokoro/samples-test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index b7e2f22..7980e9d 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -20,6 +20,7 @@ set -eo pipefail echo $(npm -v) echo $(which npm) +echo $(npm prefix -g) # Setup service account credentials. export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account From 2f4d73e933035f957e2c851d9ce2ac1aeddc242f Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:25:10 -0800 Subject: [PATCH 17/29] Update samples-test.sh --- .kokoro/samples-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index 7980e9d..445cc45 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -40,7 +40,7 @@ if [ -f samples/package.json ]; then # Install and link samples cd samples/ - npm link ../ + npm link gcp-metadata npm install cd .. # If tests are running against main branch, configure flakybot From 706989c231f2abec022271b3d84ee8edaf86cdcd Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:37:56 -0800 Subject: [PATCH 18/29] Update samples-test.sh --- .kokoro/samples-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index 445cc45..5948166 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -16,7 +16,7 @@ set -eo pipefail -# export NPM_CONFIG_PREFIX=/home/node/.npm-global +export NPM_CONFIG_PREFIX=${HOME}/.npm-global echo $(npm -v) echo $(which npm) From ee4219434aa6ade67ec73fa8062b19c086c0dc87 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 15:33:40 -0800 Subject: [PATCH 19/29] Update samples-test.sh --- .kokoro/samples-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index 5948166..484342f 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -16,7 +16,7 @@ set -eo pipefail -export NPM_CONFIG_PREFIX=${HOME}/.npm-global +# export NPM_CONFIG_PREFIX=${HOME}/.npm-global echo $(npm -v) echo $(which npm) From 1c61f3263f90f5f7ecad83dcff9af6b6c3e77484 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:02:37 -0800 Subject: [PATCH 20/29] Update samples-test.sh --- .kokoro/samples-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index 484342f..10c0eb6 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -40,7 +40,7 @@ if [ -f samples/package.json ]; then # Install and link samples cd samples/ - npm link gcp-metadata + npm link ../ npm install cd .. # If tests are running against main branch, configure flakybot From d51949f9f3a28c8f53b0537c7f6e626ba4a2555f Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:39:44 -0800 Subject: [PATCH 21/29] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2b15321..41f4716 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "cross-env": "^7.0.3", "gaxios": "^6.7.1", "gcbuild": "^1.3.39", - "gcx": "^2.0.27", + "gcx": "^1.0.0", "gts": "^6.0.2", "jsdoc": "^4.0.4", "jsdoc-fresh": "^3.0.0", From 499535c3947f600ed3c90aea2d51b28502685641 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:57:36 -0800 Subject: [PATCH 22/29] Update package.json --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 41f4716..b07a4b3 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,10 @@ ], "author": "Google LLC", "license": "Apache-2.0", + "dependencies": { + "json-bigint": "^1.0.0", + "gaxios": "^6.7.1", + }, "devDependencies": { "@google-cloud/functions": "^3.6.0", "@types/json-bigint": "^1.0.4", @@ -47,14 +51,12 @@ "@types/uuid": "^10.0.0", "c8": "^10.1.2", "cross-env": "^7.0.3", - "gaxios": "^6.7.1", "gcbuild": "^1.3.39", "gcx": "^1.0.0", "gts": "^6.0.2", "jsdoc": "^4.0.4", "jsdoc-fresh": "^3.0.0", "jsdoc-region-tag": "^3.0.0", - "json-bigint": "^1.0.0", "linkinator": "^6.1.2", "mocha": "^10.8.2", "ncp": "^2.0.0", From a0c0bf1e6f799e98afe7df26deca8ce332d11685 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:59:12 -0800 Subject: [PATCH 23/29] Update samples-test.sh --- .kokoro/samples-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index 10c0eb6..8f5a5e0 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -16,7 +16,7 @@ set -eo pipefail -# export NPM_CONFIG_PREFIX=${HOME}/.npm-global +export NPM_CONFIG_PREFIX=${HOME}/.npm-global echo $(npm -v) echo $(which npm) From 314127a37adbb63215b05164c5a8443cb6a5b95e Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Nov 2024 17:07:47 -0800 Subject: [PATCH 24/29] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b07a4b3..e2a7eb0 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "license": "Apache-2.0", "dependencies": { "json-bigint": "^1.0.0", - "gaxios": "^6.7.1", + "gaxios": "^6.7.1" }, "devDependencies": { "@google-cloud/functions": "^3.6.0", From 0e49b9fae3b72b5d8b46b002318a5de2d3f52cbc Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Fri, 22 Nov 2024 11:19:04 -0800 Subject: [PATCH 25/29] Update .OwlBot.lock.yaml --- .github/.OwlBot.lock.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7863beb..39a62ca 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest - digest: sha256:54d3915b7c06c51f4339072d9ae9ddec43fe3197d5dd45122ca6ab7a02168765 -# created: 2024-10-04T20:16:11.598831243Z + digest: sha256:0d39e59663287ae929c1d4ccf8ebf7cef9946826c9b86eda7e85d8d752dbb584 +# created: 2024-11-21T22:39:44.342569463Z From f47b9a615272437c470eb274ae43b6248cee5e15 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 22 Nov 2024 19:20:59 +0000 Subject: [PATCH 26/29] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-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/release-trigger.yml | 1 + .github/workflows/ci.yaml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml index d4ca941..f4851e2 100644 --- a/.github/release-trigger.yml +++ b/.github/release-trigger.yml @@ -1 +1,2 @@ enabled: true +multiScmName: gcp-metadata \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d3ecae9..791891a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [18, 20, 22}] + node: [18, 20, 22] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From ed7f645a431fc473a82c883ff7b21f6c7952af9a Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Wed, 11 Dec 2024 00:35:30 -0800 Subject: [PATCH 27/29] Update .OwlBot.lock.yaml From 668cd8e80c06c79a89f58398fc477797b5a6480d Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 11 Dec 2024 01:18:17 -0800 Subject: [PATCH 28/29] update samples test --- .kokoro/samples-test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.kokoro/samples-test.sh b/.kokoro/samples-test.sh index c1cb0fc..5287753 100755 --- a/.kokoro/samples-test.sh +++ b/.kokoro/samples-test.sh @@ -16,7 +16,9 @@ set -eo pipefail -export NPM_CONFIG_PREFIX=${HOME}/.npm-global +# Ensure the npm global directory is writable, otherwise rebuild `npm` +mkdir -p $NPM_CONFIG_PREFIX +npm config -g ls || npm i -g npm@`npm --version` # Setup service account credentials. export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account From 9224b47b74a15718c584629903639a809ef99c59 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Wed, 11 Dec 2024 02:01:05 -0800 Subject: [PATCH 29/29] run lint --- src/index.ts | 20 ++++++++++---------- system-test/system.ts | 8 ++++---- test/index.test.ts | 16 ++++++++-------- test/utils/gcp-residency.ts | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/index.ts b/src/index.ts index 82e13a0..cf81421 100644 --- a/src/index.ts +++ b/src/index.ts @@ -100,7 +100,7 @@ function validate(options: Options) { break; case 'qs': throw new Error( - "'qs' is not a valid configuration option. Please use 'params' instead." + "'qs' is not a valid configuration option. Please use 'params' instead.", ); default: throw new Error(`'${key}' is not a valid configuration option.`); @@ -112,14 +112,14 @@ async function metadataAccessor( type: string, options?: string | Options, noResponseRetries?: number, - fastFail?: boolean + fastFail?: boolean, ): Promise; async function metadataAccessor(metadata: MetadataAccessor): Promise; async function metadataAccessor( type: MetadataAccessor | string, options: string | Options = {}, noResponseRetries = 3, - fastFail = false + fastFail = false, ): Promise { let metadataKey = ''; let params: {} = {}; @@ -162,7 +162,7 @@ async function metadataAccessor( // NOTE: node.js converts all incoming headers to lower case. if (res.headers[HEADER_NAME.toLowerCase()] !== HEADER_VALUE) { throw new Error( - `Invalid response from metadata service: incorrect ${HEADER_NAME} header.` + `Invalid response from metadata service: incorrect ${HEADER_NAME} header.`, ); } @@ -178,7 +178,7 @@ async function metadataAccessor( } async function fastFailMetadataRequest( - options: GaxiosOptions + options: GaxiosOptions, ): Promise { const secondaryOptions = { ...options, @@ -314,7 +314,7 @@ export async function bulk< r[key] = res; })(); - }) + }), ); return r as R; @@ -342,8 +342,8 @@ export async function isAvailable() { if (!(value in METADATA_SERVER_DETECTION)) { throw new RangeError( `Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${value}\`, but it should be \`${Object.keys( - METADATA_SERVER_DETECTION - ).join('`, `')}\`, or unset` + METADATA_SERVER_DETECTION, + ).join('`, `')}\`, or unset`, ); } @@ -372,7 +372,7 @@ export async function isAvailable() { // If the default HOST_ADDRESS has been overridden, we should not // make an effort to try SECONDARY_HOST_ADDRESS (as we are likely in // a non-GCP environment): - !(process.env.GCE_METADATA_IP || process.env.GCE_METADATA_HOST) + !(process.env.GCE_METADATA_IP || process.env.GCE_METADATA_HOST), ); } await cachedIsAvailableResponse; @@ -409,7 +409,7 @@ export async function isAvailable() { if (err.code) code = err.code; process.emitWarning( `received unexpected error = ${err.message} code = ${code}`, - 'MetadataLookupWarning' + 'MetadataLookupWarning', ); } diff --git a/system-test/system.ts b/system-test/system.ts index 94c9abb..8144ea0 100644 --- a/system-test/system.ts +++ b/system-test/system.ts @@ -84,13 +84,13 @@ describe('gcp metadata', () => { const result = await gcbuild.build({ sourcePath: path.join( __dirname, - '../../system-test/fixtures/cloudbuild' + '../../system-test/fixtures/cloudbuild', ), }); console.log(result.log); assert.ok(/isAvailable: true/.test(result.log)); assert.ok( - result.log.includes('"default":{"aliases":["default"],"email"') + result.log.includes('"default":{"aliases":["default"],"email"'), ); } catch (e) { console.error((e as gcbuild.BuildError).log); @@ -127,7 +127,7 @@ async function pruneFunctions(sessionOnly: boolean) { console.error(`There was a problem deleting function ${fn.name}.`); console.error(e); }); - }) + }), ); } @@ -158,6 +158,6 @@ async function packModule() { targets.map(target => { const to = `system-test/fixtures/${target}/${pkg.name}.tgz`; return copy(from, to); - }) + }), ); } diff --git a/test/index.test.ts b/test/index.test.ts index d23eeb5..abf43b6 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -179,7 +179,7 @@ describe('unit test', () => { .reply(200, {}, {[gcp.HEADER_NAME.toLowerCase()]: 'Hazelnut'}); await assert.rejects( gcp.instance(), - /Invalid response from metadata service: incorrect Metadata-Flavor header./ + /Invalid response from metadata service: incorrect Metadata-Flavor header./, ); scope.done(); }); @@ -226,7 +226,7 @@ describe('unit test', () => { await assert.rejects( // eslint-disable-next-line @typescript-eslint/no-explicit-any gcp.instance({qs: {one: 'two'}} as any), - /'qs' is not a valid configuration option. Please use 'params' instead\./ + /'qs' is not a valid configuration option. Please use 'params' instead\./, ); }); @@ -234,7 +234,7 @@ describe('unit test', () => { await assert.rejects( // eslint-disable-next-line @typescript-eslint/no-explicit-any gcp.instance({fake: 'news'} as any), - /'fake' is not a valid/ + /'fake' is not a valid/, ); }); @@ -251,7 +251,7 @@ describe('unit test', () => { async function secondaryHostRequest( delay: number, - responseType = 'success' + responseType = 'success', ): Promise { let secondary: nock.Scope; if (responseType === 'success') { @@ -467,7 +467,7 @@ describe('unit test', () => { }); it('should fail on isAvailable if request times out', async () => { - secondaryHostRequest(5000); + void secondaryHostRequest(5000); const primary = nock(HOST) .get(`${PATH}/${TYPE}`) .delayConnection(3500) @@ -482,7 +482,7 @@ describe('unit test', () => { it('should fail on isAvailable if GCE_METADATA_HOST times out', async () => { process.env.GCE_METADATA_HOST = '127.0.0.1:8080'; - secondaryHostRequest(5000); + void secondaryHostRequest(5000); const primary = nock(`http://${process.env.GCE_METADATA_HOST}`) .get(`${PATH}/${TYPE}`) .delayConnection(3500) @@ -540,7 +540,7 @@ describe('unit test', () => { process.on('warning', warning => { assert.strictEqual( warning.toString().includes('unexpected error'), - true + true, ); return resolve(); }); @@ -596,7 +596,7 @@ describe('unit test', () => { it('should only make one outbound request, if isAvailable() called in rapid succession', async () => { const secondary = secondaryHostRequest(500); const primary = nock(HOST).get(`${PATH}/${TYPE}`).reply(200, {}, HEADERS); - gcp.isAvailable(); + void gcp.isAvailable(); // because we haven't created additional mocks, we expect this to fail // if we were not caching the first isAvailable() call: const isGCE = await gcp.isAvailable(); diff --git a/test/utils/gcp-residency.ts b/test/utils/gcp-residency.ts index 144fa78..51640f3 100644 --- a/test/utils/gcp-residency.ts +++ b/test/utils/gcp-residency.ts @@ -47,7 +47,7 @@ export class GCPResidencyUtil { this.stubs.osNetworkInterfaces ??= this.sandbox.stub( os, - 'networkInterfaces' + 'networkInterfaces', ); this.stubs.osNetworkInterfaces.returns({ 'test-interface': [{mac} as os.NetworkInterfaceInfo],