Skip to content

Commit

Permalink
chore!: migrate to Node 14 (googleapis#4443)
Browse files Browse the repository at this point in the history
* feat: upgrade our libraries to node 14

* chore!: update libraries to Node 14

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Update run_single_test.sh

* retry with dev dep

* retry

* retry

* Update run_single_test.sh

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* retry

* retry

* retry

* retyr

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* retry

* retry

* retry

* chore: update package.json

* remove enable scripts

* remove procurement

* fix unsafe optional chaining

* Update presubmit.yaml

* Update continuous.yaml

* Update presubmit.yaml

* Update continuous.yaml

* chore: bump versions

* fix: recompile and gts fix everything

* chore(deps): add gapic-tools dependency where it was missing

* chore(deps): update c8 to 8.0.1

* test: fix samples test for channel

* samples: fix sample for security center

* fix: remove webpack dependencies

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Alexander Fenster <[email protected]>
  • Loading branch information
3 people authored Aug 5, 2023
1 parent 74d46d5 commit 2260f12
Show file tree
Hide file tree
Showing 907 changed files with 650,000 additions and 31,023 deletions.
2 changes: 1 addition & 1 deletion .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ branchProtectionRules:
- "samples-presubmit-node14-with-credentials (long-door-651)"
- "samples-presubmit-node14 (long-door-651)"
- "units (14)"
- "units (12)"
- "units (16)"
- "units (18)"
- "units (20)"
# List of explicit permissions to add (additive only)
permissionRules:
# Team slug to add to repository permissions
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/continuous.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
node: [14]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- uses: pnpm/action-setup@v2
with:
version: 7.32.2
Expand All @@ -24,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [12, 14, 16, 18]
node: [14, 16, 18, 20]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
node: [14]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- uses: pnpm/action-setup@v2
with:
version: 7.32.2
Expand All @@ -22,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [12, 14, 16, 18]
node: [14, 16, 18, 20]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/release/docs.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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:14-user"
}

# Use the trampoline script to run in docker.
Expand Down
4 changes: 2 additions & 2 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG NODE_VERSION=14
ARG NODE_VERSION=16
ARG FLAKYBOT_VERSION=1.1.0

FROM node:${NODE_VERSION}-alpine as build
Expand Down Expand Up @@ -46,4 +46,4 @@ COPY --from=build /root/.local/share/pnpm /root/.local/share/pnpm
RUN apk add --no-cache git bash python3

ENV PNPM_HOME=/root/.local/share/pnpm
ENV PATH=$PNPM_HOME:$PATH
ENV PATH=$PNPM_HOME:/bin/flakybot:usr/local/gcloud/google-cloud-sdk/bin:$PATH
9 changes: 8 additions & 1 deletion ci/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ options:
substitutions:
_BUILD_TYPE: "presubmit"
_TEST_TYPE: "system"
_NODE_VERSION: "14"
_NODE_VERSION: "16"
_REPO_OWNER: "googleapis"
_REPO_NAME: "google-cloud-node"

logsBucket: 'gs://${_LOGS_BUCKET}/logs/google-cloud-node/${_BUILD_TYPE}/${COMMIT_SHA}/${TRIGGER_NAME}'
timeout: 32400s
Expand Down Expand Up @@ -47,3 +49,8 @@ steps:
env:
- 'BUILD_TYPE=${_BUILD_TYPE}'
- 'TEST_TYPE=${_TEST_TYPE}'
- 'BUILD_ID=$BUILD_ID'
- 'PROJECT_ID=$PROJECT_ID'
- 'REPO_OWNER=${_REPO_OWNER}'
- 'REPO_NAME=${_REPO_NAME}'
- 'COMMIT_SHA=$COMMIT_SHA'
7 changes: 6 additions & 1 deletion ci/cloudbuild_with_credentials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ options:
substitutions:
_BUILD_TYPE: "presubmit"
_TEST_TYPE: "system"
_NODE_VERSION: "14"
_NODE_VERSION: "16"

logsBucket: 'gs://${_LOGS_BUCKET}/logs/google-cloud-node/${_BUILD_TYPE}/${COMMIT_SHA}/${TRIGGER_NAME}'
timeout: 7200s
Expand Down Expand Up @@ -46,3 +46,8 @@ steps:
- 'BUILD_TYPE=${_BUILD_TYPE}'
- 'TEST_TYPE=${_TEST_TYPE}'
- 'GOOGLE_APPLICATION_CREDENTIALS=/workspace/google_application_credentials.json'
- 'BUILD_ID=$BUILD_ID'
- 'PROJECT_ID=$PROJECT_ID'
- 'REPO_OWNER=${_REPO_OWNER}'
- 'REPO_NAME=${_REPO_NAME}'
- 'COMMIT_SHA=$COMMIT_SHA'
2 changes: 1 addition & 1 deletion ci/export_triggers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
set -eo pipefail

NODE_VERSIONS=(
"14"
"16"
)

echo "change directory to the project root"
Expand Down
2 changes: 1 addition & 1 deletion ci/import_triggers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
set -eo pipefail

NODE_VERSIONS=(
"14"
"16"
)

echo "change directory to the project root"
Expand Down
21 changes: 5 additions & 16 deletions ci/run_single_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ set -e
export REGION_ID='uc'
export PROJECT_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}")/..)

tests_without_node12="typeless-sample-bot gapic-node-templating node-bootstrap-container"

if [ -z "${BUILD_TYPE}" ]; then
echo "missing BUILD_TYPE env var"
exit 1
Expand All @@ -41,15 +39,9 @@ if [ ${BUILD_TYPE} != "presubmit" ]; then
fi

# Install dependencies
if [[ "${tests_without_node12[*]}" =~ "${PROJECT}" ]] && [[ ${NODE_VERSION} == "12.22.12" ]] && [[ ${TEST_TYPE} != "lint" ]]; then
echo "not running tests for Node 12"
elif [[ ${NODE_VERSION} == "12.22.12" ]]; then
echo "npm install --unsafe-perm --ignore-scripts --engine-strict --only=prod; npm install --unsafe-perm"
npm install --unsafe-perm --ignore-scripts --engine-strict --only=prod; npm install --unsafe-perm
else
echo "pnpm install --ignore-scripts --engine-strict --prod; pnpm install"
pnpm install --ignore-scripts --engine-strict --prod; pnpm install
fi
echo "pnpm install --ignore-scripts --engine-strict --prod; pnpm install"
pnpm install --ignore-scripts --engine-strict --prod; pnpm install


retval=0

Expand All @@ -69,11 +61,8 @@ system)
retval=$?
;;
units)
# Skipping Node 12 tests for projects outside of gapic autogenerated libraries that don't need to run on Node 12
if ! [[ "${tests_without_node12[*]}" =~ "${PROJECT}" ]] || [[ ${NODE_VERSION} != "12.22.12" ]]; then
pnpm test
retval=$?
fi
pnpm test
retval=$?
;;
*)
;;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"dependencies": {
"chalk": "^5.0.0",
"figures": "^5.0.0",
"gaxios": "^4.0.0",
"gaxios": "^6.0.0",
"parse-link-header": "^2.0.0"
},
"devDependencies": {
Expand Down
9 changes: 5 additions & 4 deletions packages/gapic-node-templating/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,21 @@
"devDependencies": {
"@types/js-yaml": "^4.0.5",
"@types/mocha": "^9.1.1",
"@types/node": "^18.0.0",
"@types/node": "^20.4.5",
"@types/nunjucks": "^3.2.1",
"@types/sinon": "^10.0.11",
"@types/yargs": "^17.0.10",
"c8": "^7.11.3",
"cross-env": "^7.0.3",
"gts": "^3.1.0",
"gapic-tools": "^0.1.8",
"gts": "^5.0.0",
"mocha": "^9.2.2",
"sinon": "^15.0.0",
"snap-shot-it": "^7.9.6",
"typescript": "^4.6.4"
"typescript": "^5.1.6"
},
"engines": {
"node": ">=14"
"node": ">=14.0.0"
},
"dependencies": {
"@google-cloud/storage": "^6.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ export async function getDistributionName(
});

const bazelLocation = join(__dirname, 'BUILD.bazel');
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (isFile((file as any).data)) {
writeFileSync(
bazelLocation,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Buffer.from((file as any).data.content, 'base64').toString('utf8')
);
}
Expand Down Expand Up @@ -115,9 +117,11 @@ export async function compileVars(

export function getServiceName(serviceConfig: ServiceConfig) {
let serviceName = '';
for (const api of serviceConfig?.apis) {
if (api.name.endsWith('Service')) {
serviceName = api.name.split('.')[api.name.split('.').length - 1];
if (serviceConfig?.apis) {
for (const api of serviceConfig?.apis ?? []) {
if (api.name.endsWith('Service')) {
serviceName = api.name.split('.')[api.name.split('.').length - 1];
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ describe('get bootstrap template vars', () => {
it('should get the distribution name', async () => {
const getContentStub = sinon
.stub(octokit.repos, 'getContent')
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.resolves({data: {name: 'BUILD.bazel', content: 'content'}} as any);

await getDistributionName(
Expand Down
8 changes: 2 additions & 6 deletions packages/google-ai-generativelanguage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@types/mocha": "^9.0.0",
"@types/node": "^20.4.5",
"@types/sinon": "^10.0.0",
"c8": "^7.3.5",
"c8": "^8.0.1",
"gapic-tools": "^0.1.8",
"gts": "^5.0.0",
"jsdoc": "^4.0.0",
Expand All @@ -59,13 +59,9 @@
"linkinator": "4.1.2",
"long": "^5.2.3",
"mocha": "^9.2.2",
"null-loader": "^4.0.1",
"pack-n-play": "^1.0.0-2",
"sinon": "^15.0.0",
"ts-loader": "^9.0.0",
"typescript": "^5.1.6",
"webpack": "^5.9.0",
"webpack-cli": "^5.0.0"
"typescript": "^5.1.6"
},
"engines": {
"node": ">=14.0.0"
Expand Down
Loading

0 comments on commit 2260f12

Please sign in to comment.