Chore: Update to node 20 (#76097)

* chore(node): update node version to 20

* chore(node): bump to 20.8.0, update drone variables

* chore(drone): update yaml config

* chore(yarn): bump yarn to latest to fix building binaries ERR_IMPORT_ASSERTION_TYPE_MISSING errors

* test(grafana-data): update whitespace in time formats for node 20 (18.13+)

* chore(node): move to LTS 20.8.1

* chore(node): bump to LTS 20.9.0
pull/77188/head
Jack Westbrook 2 years ago committed by GitHub
parent 314bea935f
commit 69af9f9ad7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 70
      .drone.yml
  2. 2
      .nvmrc
  3. 426
      .yarn/releases/yarn-3.6.4.cjs
  4. 4
      .yarnrc.yml
  5. 2
      Dockerfile
  6. 4
      contribute/developer-guide.md
  7. 4
      package.json
  8. 6
      packages/grafana-data/src/datetime/formats.test.ts
  9. 4
      scripts/build/ci-build/Dockerfile
  10. 2
      scripts/drone/variables.star

@ -122,14 +122,14 @@ steps:
- commands: - commands:
- yarn install --immutable - yarn install --immutable
depends_on: [] depends_on: []
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: yarn-install name: yarn-install
- commands: - commands:
- apk add --update git bash - apk add --update git bash
- yarn betterer ci - yarn betterer ci
depends_on: depends_on:
- yarn-install - yarn-install
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: betterer-frontend name: betterer-frontend
- commands: - commands:
- apk add --update curl jq bash - apk add --update curl jq bash
@ -158,7 +158,7 @@ steps:
- yarn-install - yarn-install
environment: environment:
TEST_MAX_WORKERS: 50% TEST_MAX_WORKERS: 50%
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: test-frontend name: test-frontend
trigger: trigger:
event: event:
@ -222,7 +222,7 @@ steps:
- commands: - commands:
- yarn install --immutable - yarn install --immutable
depends_on: [] depends_on: []
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: yarn-install name: yarn-install
- commands: - commands:
- yarn run prettier:check - yarn run prettier:check
@ -232,7 +232,7 @@ steps:
- yarn-install - yarn-install
environment: environment:
TEST_MAX_WORKERS: 50% TEST_MAX_WORKERS: 50%
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: lint-frontend name: lint-frontend
- commands: - commands:
- apk add --update git - apk add --update git
@ -247,7 +247,7 @@ steps:
- yarn run i18n:compile - yarn run i18n:compile
depends_on: depends_on:
- yarn-install - yarn-install
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: verify-i18n name: verify-i18n
trigger: trigger:
event: event:
@ -529,7 +529,7 @@ steps:
- commands: - commands:
- yarn install --immutable - yarn install --immutable
depends_on: [] depends_on: []
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: yarn-install name: yarn-install
- commands: - commands:
- apk add --update jq bash - apk add --update jq bash
@ -540,7 +540,7 @@ steps:
- yarn-install - yarn-install
environment: environment:
NODE_OPTIONS: --max_old_space_size=8192 NODE_OPTIONS: --max_old_space_size=8192
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: build-frontend-packages name: build-frontend-packages
- failure: ignore - failure: ignore
image: grafana/drone-downstream image: grafana/drone-downstream
@ -678,7 +678,7 @@ steps:
- build-frontend-packages - build-frontend-packages
environment: environment:
NODE_OPTIONS: --max_old_space_size=4096 NODE_OPTIONS: --max_old_space_size=4096
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: build-storybook name: build-storybook
when: when:
paths: paths:
@ -1035,7 +1035,7 @@ steps:
- commands: - commands:
- yarn install --immutable - yarn install --immutable
depends_on: [] depends_on: []
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: yarn-install name: yarn-install
- commands: - commands:
- pip3 install codespell - pip3 install codespell
@ -1048,7 +1048,7 @@ steps:
- yarn-install - yarn-install
environment: environment:
NODE_OPTIONS: --max_old_space_size=8192 NODE_OPTIONS: --max_old_space_size=8192
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: lint-docs name: lint-docs
- commands: - commands:
- mkdir -p /hugo/content/docs/grafana/latest - mkdir -p /hugo/content/docs/grafana/latest
@ -1388,7 +1388,7 @@ steps:
- commands: - commands:
- yarn install --immutable - yarn install --immutable
depends_on: [] depends_on: []
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: yarn-install name: yarn-install
- commands: - commands:
- pip3 install codespell - pip3 install codespell
@ -1401,7 +1401,7 @@ steps:
- yarn-install - yarn-install
environment: environment:
NODE_OPTIONS: --max_old_space_size=8192 NODE_OPTIONS: --max_old_space_size=8192
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: lint-docs name: lint-docs
- commands: - commands:
- mkdir -p /hugo/content/docs/grafana/latest - mkdir -p /hugo/content/docs/grafana/latest
@ -1462,14 +1462,14 @@ steps:
- commands: - commands:
- yarn install --immutable - yarn install --immutable
depends_on: [] depends_on: []
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: yarn-install name: yarn-install
- commands: - commands:
- apk add --update git bash - apk add --update git bash
- yarn betterer ci - yarn betterer ci
depends_on: depends_on:
- yarn-install - yarn-install
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: betterer-frontend name: betterer-frontend
- commands: - commands:
- yarn run ci:test-frontend - yarn run ci:test-frontend
@ -1477,7 +1477,7 @@ steps:
- yarn-install - yarn-install
environment: environment:
TEST_MAX_WORKERS: 50% TEST_MAX_WORKERS: 50%
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: test-frontend name: test-frontend
trigger: trigger:
branch: main branch: main
@ -1519,7 +1519,7 @@ steps:
- commands: - commands:
- yarn install --immutable - yarn install --immutable
depends_on: [] depends_on: []
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: yarn-install name: yarn-install
- commands: - commands:
- yarn run prettier:check - yarn run prettier:check
@ -1529,7 +1529,7 @@ steps:
- yarn-install - yarn-install
environment: environment:
TEST_MAX_WORKERS: 50% TEST_MAX_WORKERS: 50%
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: lint-frontend name: lint-frontend
- commands: - commands:
- apk add --update git - apk add --update git
@ -1544,7 +1544,7 @@ steps:
- yarn run i18n:compile - yarn run i18n:compile
depends_on: depends_on:
- yarn-install - yarn-install
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: verify-i18n name: verify-i18n
trigger: trigger:
branch: main branch: main
@ -1778,7 +1778,7 @@ steps:
- commands: - commands:
- yarn install --immutable - yarn install --immutable
depends_on: [] depends_on: []
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: yarn-install name: yarn-install
- commands: - commands:
- apk add --update jq - apk add --update jq
@ -1789,7 +1789,7 @@ steps:
- yarn install --mode=update-lockfile - yarn install --mode=update-lockfile
depends_on: depends_on:
- yarn-install - yarn-install
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: update-package-json-version name: update-package-json-version
- commands: - commands:
- apk add --update jq bash - apk add --update jq bash
@ -1801,7 +1801,7 @@ steps:
- update-package-json-version - update-package-json-version
environment: environment:
NODE_OPTIONS: --max_old_space_size=8192 NODE_OPTIONS: --max_old_space_size=8192
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: build-frontend-packages name: build-frontend-packages
- commands: - commands:
- /src/grafana-build package --distro=linux/amd64,linux/arm64 --go-version=1.20.10 - /src/grafana-build package --distro=linux/amd64,linux/arm64 --go-version=1.20.10
@ -1926,7 +1926,7 @@ steps:
- build-frontend-packages - build-frontend-packages
environment: environment:
NODE_OPTIONS: --max_old_space_size=4096 NODE_OPTIONS: --max_old_space_size=4096
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: build-storybook name: build-storybook
when: when:
paths: paths:
@ -1976,7 +1976,7 @@ steps:
GRAFANA_MISC_STATS_API_KEY: GRAFANA_MISC_STATS_API_KEY:
from_secret: grafana_misc_stats_api_key from_secret: grafana_misc_stats_api_key
failure: ignore failure: ignore
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: publish-frontend-metrics name: publish-frontend-metrics
when: when:
repo: repo:
@ -2058,7 +2058,7 @@ steps:
environment: environment:
NPM_TOKEN: NPM_TOKEN:
from_secret: npm_token from_secret: npm_token
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: release-canary-npm-packages name: release-canary-npm-packages
when: when:
paths: paths:
@ -2686,7 +2686,7 @@ steps:
- commands: - commands:
- yarn install --immutable - yarn install --immutable
depends_on: [] depends_on: []
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: yarn-install name: yarn-install
- commands: - commands:
- ./bin/build artifacts npm retrieve --tag ${DRONE_TAG} - ./bin/build artifacts npm retrieve --tag ${DRONE_TAG}
@ -2953,14 +2953,14 @@ steps:
- commands: - commands:
- yarn install --immutable - yarn install --immutable
depends_on: [] depends_on: []
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: yarn-install name: yarn-install
- commands: - commands:
- apk add --update git bash - apk add --update git bash
- yarn betterer ci - yarn betterer ci
depends_on: depends_on:
- yarn-install - yarn-install
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: betterer-frontend name: betterer-frontend
- commands: - commands:
- yarn run ci:test-frontend - yarn run ci:test-frontend
@ -2968,7 +2968,7 @@ steps:
- yarn-install - yarn-install
environment: environment:
TEST_MAX_WORKERS: 50% TEST_MAX_WORKERS: 50%
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: test-frontend name: test-frontend
trigger: trigger:
event: event:
@ -3365,14 +3365,14 @@ steps:
- commands: - commands:
- yarn install --immutable - yarn install --immutable
depends_on: [] depends_on: []
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: yarn-install name: yarn-install
- commands: - commands:
- apk add --update git bash - apk add --update git bash
- yarn betterer ci - yarn betterer ci
depends_on: depends_on:
- yarn-install - yarn-install
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: betterer-frontend name: betterer-frontend
- commands: - commands:
- yarn run ci:test-frontend - yarn run ci:test-frontend
@ -3380,7 +3380,7 @@ steps:
- yarn-install - yarn-install
environment: environment:
TEST_MAX_WORKERS: 50% TEST_MAX_WORKERS: 50%
image: node:18.12.0-alpine image: node:20.9.0-alpine
name: test-frontend name: test-frontend
trigger: trigger:
cron: cron:
@ -4386,7 +4386,7 @@ steps:
- commands: - commands:
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM alpine/git:2.40.1 - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM alpine/git:2.40.1
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM golang:1.20.10-alpine - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM golang:1.20.10-alpine
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM node:18.12.0-alpine - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM node:20.9.0-alpine
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM google/cloud-sdk:431.0.0 - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM google/cloud-sdk:431.0.0
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM grafana/grafana-ci-deploy:1.3.3 - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM grafana/grafana-ci-deploy:1.3.3
- trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM alpine:3.18.3 - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM alpine:3.18.3
@ -4420,7 +4420,7 @@ steps:
- commands: - commands:
- trivy --exit-code 1 --severity HIGH,CRITICAL alpine/git:2.40.1 - trivy --exit-code 1 --severity HIGH,CRITICAL alpine/git:2.40.1
- trivy --exit-code 1 --severity HIGH,CRITICAL golang:1.20.10-alpine - trivy --exit-code 1 --severity HIGH,CRITICAL golang:1.20.10-alpine
- trivy --exit-code 1 --severity HIGH,CRITICAL node:18.12.0-alpine - trivy --exit-code 1 --severity HIGH,CRITICAL node:20.9.0-alpine
- trivy --exit-code 1 --severity HIGH,CRITICAL google/cloud-sdk:431.0.0 - trivy --exit-code 1 --severity HIGH,CRITICAL google/cloud-sdk:431.0.0
- trivy --exit-code 1 --severity HIGH,CRITICAL grafana/grafana-ci-deploy:1.3.3 - trivy --exit-code 1 --severity HIGH,CRITICAL grafana/grafana-ci-deploy:1.3.3
- trivy --exit-code 1 --severity HIGH,CRITICAL alpine:3.18.3 - trivy --exit-code 1 --severity HIGH,CRITICAL alpine:3.18.3
@ -4667,6 +4667,6 @@ kind: secret
name: gcr_credentials name: gcr_credentials
--- ---
kind: signature kind: signature
hmac: 29a933affceb9cc39b285d936de9e6327deedbb80f1285fa645d596f89ede442 hmac: 975f4bc4ea819f11b9abf46a1e17fc55161551ab02b5c6a905393def886ad4ae
... ...

@ -1 +1 @@
v18.12.0 v20.9.0

File diff suppressed because one or more lines are too long

@ -5,7 +5,7 @@ nodeLinker: pnp
packageExtensions: packageExtensions:
'@storybook/core-common@7.4.5': '@storybook/core-common@7.4.5':
dependencies: dependencies:
'@storybook/react-webpack5': '7.4.5' '@storybook/react-webpack5': 7.4.5
doctrine@3.0.0: doctrine@3.0.0:
dependencies: dependencies:
assert: 2.0.0 assert: 2.0.0
@ -35,7 +35,7 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs - path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs
spec: 'https://mskelton.dev/yarn-outdated/v2' spec: 'https://mskelton.dev/yarn-outdated/v2'
yarnPath: .yarn/releases/yarn-3.6.1.cjs yarnPath: .yarn/releases/yarn-3.6.4.cjs
# Uncomment the following lines if you want to use Verdaccio local npm registry. Read more at packages/README.md # Uncomment the following lines if you want to use Verdaccio local npm registry. Read more at packages/README.md
# npmScopes: # npmScopes:
# grafana: # grafana:

@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
ARG BASE_IMAGE=alpine:3.18.3 ARG BASE_IMAGE=alpine:3.18.3
ARG JS_IMAGE=node:18-alpine3.18 ARG JS_IMAGE=node:20-alpine3.18
ARG JS_PLATFORM=linux/amd64 ARG JS_PLATFORM=linux/amd64
ARG GO_IMAGE=golang:1.20.10-alpine3.18 ARG GO_IMAGE=golang:1.20.10-alpine3.18

@ -18,7 +18,7 @@ We recommend using [Homebrew](https://brew.sh/) for installing any missing depen
``` ```
brew install git brew install git
brew install go brew install go
brew install node@18 brew install node@20
npm install -g yarn npm install -g yarn
``` ```
@ -61,7 +61,7 @@ To remove precommit hooks, run
make lefthook-uninstall make lefthook-uninstall
``` ```
> [!NOTE] > [!NOTE]
> Contributors working on the frontend are highly encouraged to install the precommit hooks, even if your IDE formats on save, so the `.betterer.results` file is kept up to sync. > Contributors working on the frontend are highly encouraged to install the precommit hooks, even if your IDE formats on save, so the `.betterer.results` file is kept up to sync.
## Build Grafana ## Build Grafana

@ -442,9 +442,9 @@
] ]
}, },
"engines": { "engines": {
"node": ">= 18" "node": ">= 20"
}, },
"packageManager": "yarn@3.6.1", "packageManager": "yarn@3.6.4",
"dependenciesMeta": { "dependenciesMeta": {
"prettier@3.0.0": { "prettier@3.0.0": {
"unplugged": true "unplugged": true

@ -14,7 +14,7 @@ describe('Date Formats', () => {
'' ''
); );
expect(format).toBe('MM/DD/YYYY, hh:mm:ss A'); expect(format).toBe('MM/DD/YYYY, hh:mm:ssA');
}); });
}); });
@ -52,8 +52,8 @@ describe('systemDateFormats', () => {
it('contains correct browser-localized date formats', () => { it('contains correct browser-localized date formats', () => {
systemDateFormats.useBrowserLocale(); systemDateFormats.useBrowserLocale();
expect(systemDateFormats.fullDate).toBe('MM/DD/YYYY, hh:mm:ss A'); expect(systemDateFormats.fullDate).toBe('MM/DD/YYYY, hh:mm:ssA');
expect(systemDateFormats.fullDateMS).toBe('MM/DD/YYYY, hh:mm:ss.SSS A'); expect(systemDateFormats.fullDateMS).toBe('MM/DD/YYYY, hh:mm:ss.SSSA');
expect(systemDateFormats.interval.millisecond).toBe('HH:mm:ss.SSS'); expect(systemDateFormats.interval.millisecond).toBe('HH:mm:ss.SSS');
expect(systemDateFormats.interval.second).toBe('HH:mm:ss'); expect(systemDateFormats.interval.second).toBe('HH:mm:ss');
expect(systemDateFormats.interval.minute).toBe('HH:mm'); expect(systemDateFormats.interval.minute).toBe('HH:mm');

@ -111,7 +111,7 @@ FROM debian:buster-20220822
ENV GOVERSION=1.20.10 \ ENV GOVERSION=1.20.10 \
PATH=/usr/local/go/bin:$PATH \ PATH=/usr/local/go/bin:$PATH \
GOPATH=/go \ GOPATH=/go \
NODEVERSION=18.12.0-1nodesource1 \ NODEVERSION=20.9.0-1nodesource1 \
YARNVERSION=1.22.19-1 YARNVERSION=1.22.19-1
# Use ARG so as not to persist environment variable in image # Use ARG so as not to persist environment variable in image
@ -148,7 +148,7 @@ RUN apt-get update && \
gem install --conservative -N fpm && \ gem install --conservative -N fpm && \
ln -s /usr/bin/llvm-dsymutil-6.0 /usr/bin/dsymutil && \ ln -s /usr/bin/llvm-dsymutil-6.0 /usr/bin/dsymutil && \
curl -fsS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ curl -fsS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
curl -O https://deb.nodesource.com/node_18.x/pool/main/n/nodejs/nodejs_${NODEVERSION}_amd64.deb &&\ curl -O https://deb.nodesource.com/node_20.x/pool/main/n/nodejs/nodejs_${NODEVERSION}_amd64.deb &&\
dpkg -i nodejs_${NODEVERSION}_amd64.deb &&\ dpkg -i nodejs_${NODEVERSION}_amd64.deb &&\
rm nodejs_${NODEVERSION}_amd64.deb &&\ rm nodejs_${NODEVERSION}_amd64.deb &&\
curl -fsS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ curl -fsS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \

@ -6,4 +6,4 @@ grabpl_version = "v3.0.42"
golang_version = "1.20.10" golang_version = "1.20.10"
# nodejs_version should match what's in ".nvmrc", but without the v prefix. # nodejs_version should match what's in ".nvmrc", but without the v prefix.
nodejs_version = "18.12.0" nodejs_version = "20.9.0"

Loading…
Cancel
Save