Skip to content

Commit

Permalink
chore: bump to node 21.1.0 (#5361)
Browse files Browse the repository at this point in the history
* chore: bump to node 21.1.0

* chore: fix linter complaint

* chore: use new npm modules cache

* fix: ts-node/esm module loader

* fix: try to see if an explicit import hook register works to fix ts-node esm performance

* chore: fix shebang lines

* fix: install nodejs using fnm (if needed)

* fix: checksum

* fix: use getAbi correctly

* chore: test nodejs version as separate step

* fix: make nodejs install work with machine executor

* chore: update node-pty-prebuilt-multiarch to 0.11.10

Apparently the NPM package name changed; I opened an issue upstream to clarify
because the github repo still links to the old NPM repo.

homebridge/node-pty-prebuilt-multiarch#31

* chore: bump typescript types and eslint packages

* chore: make no-explicit-any a warning only

* fix: consistent versions for node-pty-multiarch

* fix: alpine docker sha hash

* fix: clean up unwanted log messages in the release binary

* fix: musl checksum

* fix: avoid issues due to cache poisoning

* fix: wait until write stream is finished

Co-authored-by: Tim Beyer <[email protected]>

* fix: use pipeline to await until write stream really finished

* fix: properly implement streaming

* chore: update circleci machine image

* fix: add env var UV_USE_IO_URING=0 to avoid kernel bug

Libuv 1.45.0 is affected by a kernel bug on certain kernels (Ubuntu 22)
This leads to errors where Garden tool downloading errors with ETXTBSY
Apparently file descriptor accounting is broken when using USE_IO_URING on older kernels

See also libuv/libuv#4141

* fix: tested error message became more detailed

---------

Co-authored-by: Steffen Neubauer <[email protected]>
Co-authored-by: Tim Beyer <[email protected]>
Co-authored-by: Garden CI <[email protected]>
  • Loading branch information
4 people authored Nov 9, 2023
1 parent dc8ba20 commit 6097048
Show file tree
Hide file tree
Showing 37 changed files with 956 additions and 1,230 deletions.
73 changes: 52 additions & 21 deletions .circleci/continue-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version: 2.1
orbs:
win: circleci/[email protected]
rok8s-scripts: fairwinds/[email protected]
node: circleci/[email protected]
macos: circleci/[email protected]

parameters:
Expand All @@ -21,8 +20,16 @@ parameters:
GARDEN_DISABLE_ANALYTICS: "true"
GARDEN_K8S_BUILD_SYNC_MODE: "mutagen"

# Libuv 1.45.0 is affected by a kernel bug on certain kernels (Ubuntu 22)
# This leads to errors where Garden tool downloading errors with ETXTBSY
# Apparently file descriptor accounting is broken when using USE_IO_URING on older kernels
# See also: https://github.com/libuv/libuv/pull/4141/files
# TODO: Remove this once libuv 1.47 landed in a future NodeJS version, and we upgraded to it.
UV_USE_IO_URING: "0"


ubuntu-vm-runner: &ubuntu-vm-runner
image: "ubuntu-2204:2023.02.1"
image: "ubuntu-2204:2023.10.1"
docker_layer_caching: true

remote-docker: &remote-docker
Expand All @@ -31,7 +38,7 @@ parameters:
docker_layer_caching: true

runner-image: &runner-image
image: gardendev/circleci-runner:18.15.0-1@sha256:c830e29ab30a1c5b08cba4d041d3325ef6958aebeba1b10b1ee9566d7b1a4d42
image: gardendev/circleci-runner:21.1.0-1@sha256:1b773f6fcde1d9b65cb8a609c823076b3048104e73f04247e0fd86aa9bcc92dd

# Configuration for our node jobs
docker-runner: &docker-runner
Expand Down Expand Up @@ -98,23 +105,58 @@ commands:
context:
description: Set this to vm if installing in a VM, to avoid conflicting caches with the docker runs
type: string
node_version:
description: The node version to use
type: string
default: v21.1.0
steps:
# See also https://github.com/CircleCI-Public/node-orb/issues/158#issuecomment-1461095390
- run: rm -rf ~/.npm
- run: rm -rf ~/.npm ~/.fnm

- restore_cache:
keys:
# Prefer using the NPM cache for the package-lock hash, but fall back to any other cache too
- npm-v4-<<parameters.context>>-{{ checksum "package-lock.json" }}
- npm-v7-<<parameters.context>>-{{ checksum "package-lock.json" }}
# If you uncomment the next line, we also restore caches if package-lock.json changed in case there is no exact match.
# We decided not to do that for now for enhanced safety: Every time we update the lock file, we build the caches from scratch. Might be a little paranoid, but hardens against possible NPM bugs.
#- npm-v4-<<parameters.context>>
#- npm-v7-<<parameters.context>>

- run:
name: Install NodeJS
command: |
if [[ "$(node --version)" != "<<parameters.node_version>>" ]]; then
export PATH="$HOME/.fnm:$PATH"
echo 'export PATH="$HOME/.fnm:$PATH"' >> $BASH_ENV
# Install fnm if it's not already installed
if which fnm; then
echo "Using cached fnm installation"
else
curl -fsSL https://raw.githubusercontent.com/Schniz/fnm/9d0dd1b04521ac4a1c25bb91a65323dbb691e40c/.ci/install.sh | bash -s -- --install-dir "$HOME/.fnm" --force-install
fi
eval "`fnm env --fnm-dir "$HOME/.fnm-cache"`"
fnm env --fnm-dir "$HOME/.fnm-cache" >> $BASH_ENV
fnm use "<<parameters.node_version>>" --fnm-dir "$HOME/.fnm-cache" --install-if-missing
fnm default "<<parameters.node_version>>" --fnm-dir "$HOME/.fnm-cache"
fi
- run:
name: Test NodeJS version
command: |
if [[ "$(node --version)" != "<<parameters.node_version>>" ]]; then
echo "NodeJS installation failed. Expected version: <<parameters.node_version>>; Actually got: $(node --version)"
exit 1
fi
- run: npm ci --prefer-offline --cache ~/.npm --no-audit

- save_cache:
key: npm-v4-<<parameters.context>>-{{ checksum "package-lock.json" }}
key: npm-v7-<<parameters.context>>-{{ checksum "package-lock.json" }}
paths:
- ~/.npm
- ~/.fnm
- ~/.fnm-cache
- node_modules
- cli/node_modules
- core/node_modules
Expand Down Expand Up @@ -251,13 +293,11 @@ commands:
# To be able to run cargo
source "$HOME/.cargo/env"
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> $BASH_ENV
# Cargo builds the other targets in Docker
cargo install cross --git https://github.com/cross-rs/cross
# So that cross can be called
source "$HOME/.cargo/env"
run_npm_dist:
description: Package built code into executables and persist to dist directory
parameters:
Expand Down Expand Up @@ -285,17 +325,12 @@ commands:
- restore_cache:
keys:
- node-cache-v2-<<parameters.context>>-{{ checksum "cli/src/build-pkg.ts" }}
- node-cache-v2-<<parameters.context>>
# Nuke caches fully on every change; Otherwise weird things can happen if the cache is poisoned.
# - node-cache-v2-<<parameters.context>>

- run:
name: Run dist script
command: |
# This is already done in the step that installs rust
# It also work on the native macos runner,
# but somehow it doesn't work for the docker based runner.
# We just source it again so we're sure it's available for the next steps
source "$HOME/.cargo/env"
npm run dist -- --version "<<parameters.version>>" <<parameters.targets>>
# We cache the node archives because the NodeJS download mirror is unreliable
Expand Down Expand Up @@ -382,8 +417,6 @@ jobs:
default: ""
steps:
- checkout
- node/install:
node-version: '18.18.2'
- install_rust
# We need rosetta for running the tests for x86_64
- macos/install-rosetta
Expand All @@ -410,8 +443,6 @@ jobs:
default: ""
steps:
- checkout
- node/install:
node-version: '18.18.2'
- install_rust
- run:
name: "Install rollup linux"
Expand Down
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
" "
]],
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "destructuredArrayIgnorePattern": "^_" }],
"@typescript-eslint/consistent-type-imports": "error"
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-explicit-any": "warn"
}
}
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- name: Set Environment Variables
run: echo "SHORT_SHA=$(echo "$GITHUB_SHA" | cut -c1-8)" >> "$GITHUB_ENV"
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Use Node.js 18.x
- name: Use Node.js 21.x
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: 18.x
node-version: 21.x
- name: Build package
run: |
npm ci
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
18.15
21.1

2 changes: 1 addition & 1 deletion cli/bin/garden-debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node --inspect --stack-trace-limit=1000 --max-semi-space-size=64
#!/usr/bin/env -S node--inspect --stack-trace-limit=1000 --max-semi-space-size=64
/*
* Copyright (C) 2018-2023 Garden Technologies, Inc. <[email protected]>
*
Expand Down
Loading

0 comments on commit 6097048

Please sign in to comment.