Skip to content

Commit

Permalink
[workspace, scripts, teraslice-cli] Update default node version to 22 (
Browse files Browse the repository at this point in the history
…#3773)

This PR makes the following changes:
- `test.yml` - set `NODE_VERSION_MAIN` and `NODE_VERSION_EXT_STORAGE` to
22 (used by verify-build, lint-and-sync , and e2e-external-storage-tests
jobs)
- `publish-master.yml` - node-version to 22
- `publish-tag.yml` - node-version to 22
- `Dockerfile` and `Dockerfile.dev` - NODE_VERSION to 22
- scripts `config.ts` - DEFAULT_NODE_VERSION to 22
- teraslice-cli `asset-src.ts` - bundleTarget defaults to node22

ref: #3771
  • Loading branch information
busma13 authored Sep 30, 2024
1 parent 082345c commit 8c934f0
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'

Expand All @@ -60,7 +60,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ on:
branches: [ master ]
env:
NODE_VERSIONS: '[18, 20, 22]'
NODE_VERSION_MAIN: '18'
NODE_VERSION_MAIN: '22'
NODE_VERSIONS_K8S: '[18, 22]'
NODE_VERSIONS_EXT_STORAGE: '[18]'
NODE_VERSIONS_EXT_STORAGE: '[22]'

jobs:
compute-node-version-vars:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NODE_VERSION is set by default in the config.ts, the following value will only
# be used if you build images by default with docker build
ARG NODE_VERSION=18
ARG NODE_VERSION=22
FROM ghcr.io/terascope/node-base:${NODE_VERSION}

ARG TERASLICE_VERSION
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NODE_VERSION is set by default in the config.ts, the following value will only
# be used if you build images by default with docker build
ARG NODE_VERSION=18
ARG NODE_VERSION=22
FROM ghcr.io/terascope/node-base:${NODE_VERSION}

ENV NODE_ENV production
Expand Down
20 changes: 18 additions & 2 deletions docs/development/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ Once the changes are merged and a new release is made, the CI will create new ba

#### Verify New Docker Images

The new Docker images will be available on Docker Hub here:
The new Docker images will be available on the Github container registry here:

https://hub.docker.com/r/terascope/node-base/tags
https://github.com/terascope/base-docker-image/pkgs/container/node-base

### 2. Updating node in assets

Expand Down Expand Up @@ -90,3 +90,19 @@ Add the new node version to all the spots needed inside each file in `.github/wo
- test.yml

Once the node version has been added to the arrays of all the workflow .yml files, pushing the branch and making a new PR should trigger CI to run new tests with the added node version. Once all tests are passing, then a new node version has been succesfully introduced to teraslice.

## Changing the default node version

Although multiple node versions are supported, there is always a "default" version.
To set a new default version make changes to the following:
### 1. In workflows repo:
- .github/workflows/asset-build-and-publish.yml - assets-upload job `node-version` variable
- .github/workflows/asset-test.yml - test-macos job `node-version` variable
- .github/workflows/refresh-docker-cache.yml and .github/workflows/cache-docker-images.yml - `node-version` variable
### 2. In teraslice repo:
- Update all .github/workflows that use the workflows repo with the new commit hash from step 1
- Dockerfile and Dockerfile.dev - `NODE_VERSION` variable
- .github/workflows/publish-master.yml and .github/workflows/publish-tag.yml - `node-version` variable
- .github/workflows/test.yml - set `NODE_VERSION_MAIN` and `NODE_VERSION_EXT_STORAGE` variables (used by verify-build, lint-and-sync , and e2e-external-storage-tests jobs)
- packages/scripts/src/helpers/config.ts - `DEFAULT_NODE_VERSION` variable
- packages/teraslice-cli/src/helpers/asset-src.ts - `bundleTarget` default in the constructor
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "teraslice-workspace",
"displayName": "Teraslice",
"version": "2.4.0",
"version": "2.5.0",
"private": true,
"homepage": "https://github.com/terascope/teraslice",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@terascope/scripts",
"displayName": "Scripts",
"version": "1.2.0",
"version": "1.3.0",
"description": "A collection of terascope monorepo scripts",
"homepage": "https://github.com/terascope/teraslice/tree/master/packages/scripts#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/src/helpers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ if (testElasticsearch) {
export const SEARCH_TEST_HOST = testHost;

export const TEST_NODE_VERSIONS = ['18', '20', '22'];
export const DEFAULT_NODE_VERSION = '18';
export const DEFAULT_NODE_VERSION = '22';
// This overrides the value in the Dockerfile
export const NODE_VERSION = process.env.NODE_VERSION || DEFAULT_NODE_VERSION;

Expand Down
2 changes: 1 addition & 1 deletion packages/teraslice-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "teraslice-cli",
"displayName": "Teraslice CLI",
"version": "2.5.0",
"version": "2.6.0",
"description": "Command line manager for teraslice jobs, assets, and cluster references.",
"keywords": [
"teraslice"
Expand Down
2 changes: 1 addition & 1 deletion packages/teraslice-cli/src/helpers/asset-src.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class AssetSrc {
devMode = false,
debug = false,
bundle = true,
bundleTarget = 'node18',
bundleTarget = 'node22',
overwrite = false
) {
if (bundle === false) {
Expand Down
2 changes: 1 addition & 1 deletion packages/teraslice/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "teraslice",
"displayName": "Teraslice",
"version": "2.4.0",
"version": "2.5.0",
"description": "Distributed computing platform for processing JSON data",
"homepage": "https://github.com/terascope/teraslice#readme",
"bugs": {
Expand Down
1 change: 1 addition & 0 deletions website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"development/tests",
"development/e2e",
"development/k8s",
"development/node",
"development/contributing"
]
},
Expand Down

0 comments on commit 8c934f0

Please sign in to comment.