Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to NodeJS 22 #5734

Merged
merged 22 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4bcb656
Bump dependencies
williamlardier Feb 13, 2025
6b3c6c8
Update mocha test commands
williamlardier Feb 13, 2025
e04feaa
Update eslint configuration
williamlardier Feb 13, 2025
d42a9aa
Update "use strict" usage
williamlardier Feb 13, 2025
d5cf655
Bump CI to use node 22 and ubuntu 24
williamlardier Feb 13, 2025
0766020
Update docker file with node 22
williamlardier Feb 13, 2025
aa0ee6b
Define minimum nodejs version as 22 in package.json
williamlardier Feb 13, 2025
df5cf73
Add build status badges to README.md
williamlardier Feb 13, 2025
227e28b
Node22 upgrade: update config.json to replace 'localhost' with '127.0…
williamlardier Feb 13, 2025
c75bab1
Refactor error handling and remove unnecessary eslint-disable comments
williamlardier Feb 13, 2025
2373e43
Replace bluebird with native Promise and use native dependencies
williamlardier Feb 13, 2025
6886ea2
Refactor code to remove unnecessary eslint-disable comments and impro…
williamlardier Feb 13, 2025
3707cab
Refactor request handling and update fetch usage in tests post node u…
williamlardier Feb 13, 2025
588bf5f
Add error handling for invalid user groups in ACL functions
williamlardier Feb 13, 2025
042f220
Remove unreachable permission check function path
williamlardier Feb 13, 2025
678f7ce
Fix callback handling in multiObjectDelete to ensure proper execution…
williamlardier Feb 13, 2025
79dd84e
Remove unused dependency: bluebird and bump async to fix vuln
williamlardier Feb 13, 2025
5343e89
Disable utapi
williamlardier Feb 13, 2025
4939850
Disable utapi tests and enforce ubuntu runner version
williamlardier Feb 14, 2025
76f392a
Use bookworm slim 22.14.0 in dockerfile
williamlardier Feb 14, 2025
ff32d12
Bump bucketclient version
williamlardier Feb 17, 2025
e005390
Bump to 9.0.0
williamlardier Feb 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-ci/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ runs:
mkdir -p /tmp/artifacts/${JOB_NAME}/;
- uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '22'
cache: 'yarn'
- name: install typescript
shell: bash
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ env:
GIT_CLONE_PROTECTION_ACTIVE: 'false'
jobs:
lint:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '22'
cache: yarn
- name: install typescript
shell: bash
Expand All @@ -100,13 +100,13 @@ jobs:
run: yamllint -c yamllint.yml $(git ls-files "*.yml")

unit-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '22'
cache: yarn
- name: install typescript
shell: bash
Expand All @@ -120,6 +120,7 @@ jobs:
yarn run cover test_legacy_location
env:
S3_LOCATION_FILE: tests/locationConfig/locationConfigTests.json
NO_PROXY: "test.scality.com,scality.com"
- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
Expand Down Expand Up @@ -149,7 +150,7 @@ jobs:
if: always()

build:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -220,7 +221,7 @@ jobs:
cache-to: type=gha,mode=max,scope=mongodb

multiple-backend:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: build
env:
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
Expand Down Expand Up @@ -262,7 +263,7 @@ jobs:
if: always()

mongo-v0-ft-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: build
env:
S3BACKEND: mem
Expand Down Expand Up @@ -300,7 +301,7 @@ jobs:
if: always()

mongo-v1-ft-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: build
env:
S3BACKEND: mem
Expand Down Expand Up @@ -345,7 +346,7 @@ jobs:
include:
- job-name: file-ft-tests
name: ${{ matrix.job-name }}
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: build
env:
S3BACKEND: file
Expand Down Expand Up @@ -383,8 +384,9 @@ jobs:
if: always()

utapi-v2-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: build
if: false
env:
ENABLE_UTAPI_V2: t
S3BACKEND: mem
Expand Down Expand Up @@ -416,7 +418,7 @@ jobs:
if: always()

quota-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
Expand Down Expand Up @@ -460,7 +462,7 @@ jobs:
if: always()

kmip-ft-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: build
env:
S3BACKEND: file
Expand Down Expand Up @@ -498,7 +500,7 @@ jobs:
if: always()

ceph-backend-test:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: build
env:
S3BACKEND: mem
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VERSION=16.20.2-bookworm-slim
ARG NODE_VERSION=22.14.0-bookworm-slim

FROM node:${NODE_VERSION} AS builder

Expand All @@ -22,8 +22,11 @@ RUN apt-get update \
&& ssh-keyscan -H github.com > /root/ssh/known_hosts

ENV PYTHON=python3
RUN npm install -g \
node-gyp \
typescript@4.9.5
COPY package.json yarn.lock /usr/src/app/
RUN npm install typescript@4.9.5 -g

RUN yarn install --production --ignore-optional --frozen-lockfile --ignore-engines --network-concurrency 1

################################################################################
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
[![Docker Pulls][badgedocker]](https://hub.docker.com/r/zenko/cloudserver)
[![Docker Pulls][badgetwitter]](https://twitter.com/zenko)

## Build Status

![Public Build Status][badgepub]
![Private Build Status][badgepriv]

## Overview

CloudServer (formerly S3 Server) is an open-source Amazon S3-compatible
Expand Down
2 changes: 1 addition & 1 deletion bin/create_bucket_with_NFS_enabled.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node
'use strict'; // eslint-disable-line strict
'use strict';

require('../lib/nfs/utilities.js').createBucketWithNFSEnabled();
2 changes: 1 addition & 1 deletion bin/create_encrypted_bucket.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
// 2>/dev/null ; exec "$(which nodejs || which node)" "$0" "$@"
'use strict'; // eslint-disable-line strict
'use strict';

require('../lib/kms/utilities.js').createEncryptedBucket();
2 changes: 1 addition & 1 deletion bin/list_bucket_metrics.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node
'use strict'; // eslint-disable-line strict
'use strict';

require('../lib/utapi/utilities.js').listMetrics('buckets');
2 changes: 1 addition & 1 deletion bin/list_metrics.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node
'use strict'; // eslint-disable-line strict
'use strict';

require('../lib/utapi/utilities.js').listMetrics();
2 changes: 1 addition & 1 deletion bin/metrics_server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
'use strict'; // eslint-disable-line strict
'use strict';

const {
startWSManagementClient,
Expand Down
2 changes: 1 addition & 1 deletion bin/search_bucket.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
// 2>/dev/null ; exec "$(which nodejs 2>/dev/null || which node)" "$0" "$@"
'use strict'; // eslint-disable-line strict
'use strict';

const { auth } = require('arsenal');
const commander = require('commander');
Expand Down
2 changes: 1 addition & 1 deletion bin/secure_channel_proxy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
'use strict'; // eslint-disable-line strict
'use strict';

const {
startWSManagementClient,
Expand Down
12 changes: 6 additions & 6 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,27 @@
"allowFrom": ["127.0.0.1/8", "::1"]
},
"metadataClient": {
"host": "localhost",
"host": "127.0.0.1",
"port": 9990
},
"dataClient": {
"host": "localhost",
"host": "127.0.0.1",
"port": 9991
},
"pfsClient": {
"host": "localhost",
"host": "127.0.0.1",
"port": 9992
},
"metadataDaemon": {
"bindAddress": "localhost",
"bindAddress": "127.0.0.1",
"port": 9990
},
"dataDaemon": {
"bindAddress": "localhost",
"bindAddress": "127.0.0.1",
"port": 9991
},
"pfsDaemon": {
"bindAddress": "localhost",
"bindAddress": "127.0.0.1",
"port": 9992
},
"recordLog": {
Expand Down
2 changes: 1 addition & 1 deletion dataserver.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line strict
'use strict';

const arsenal = require('arsenal');
const { config } = require('./lib/Config.js');
Expand Down
38 changes: 26 additions & 12 deletions .eslintrc → eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
{
"extends": "scality",
"plugins": [
"mocha"
],
"env": {
"es2020": true
import mocha from "eslint-plugin-mocha";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [...compat.extends('@scality/scality'), {
plugins: {
mocha,
},
"rules": {

languageOptions: {
ecmaVersion: 2020,
sourceType: "script",
},

rules: {
"import/extensions": "off",
"lines-around-directive": "off",
"no-underscore-dangle": "off",
Expand Down Expand Up @@ -50,8 +66,6 @@
"no-multi-spaces": "off",
"quote-props": "off",
"mocha/no-exclusive-tests": "error",
"no-redeclare": ["error", { "builtinGlobals": false }],
},
"parserOptions": {
"ecmaVersion": 2020
}
}
}];
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line strict
'use strict';

require('werelogs').stderrUtils.catchAndTimestampStderr(
undefined,
Expand Down
6 changes: 5 additions & 1 deletion lib/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ const {
allowedUtapiEventFilterStates,
supportedLifecycleRules,
} = require('../constants');
const { utapiVersion } = require('utapi');

// TODO CLDSRV-610: re-enable utapi
// const { utapiVersion } = require('utapi');
const utapiVersion = null;

const { scaleMsPerDay } = s3middleware.objectUtils;

const constants = require('../constants');
Expand Down
3 changes: 0 additions & 3 deletions lib/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,9 @@ auth.setHandler(vault);
const api = {
callApiMethod(apiMethod, request, response, log, callback) {
// Attach the apiMethod method to the request, so it can used by monitoring in the server
// eslint-disable-next-line no-param-reassign
request.apiMethod = apiMethod;
// Array of end of API callbacks, used to perform some logic
// at the end of an API.
// eslint-disable-next-line no-param-reassign
request.finalizerHooks = [];

const actionLog = monitoringMap[apiMethod];
Expand Down Expand Up @@ -150,7 +148,6 @@ const api = {
// Extract all the _apiMethods and store them in an array
const apiMethods = requestContexts ? requestContexts.map(context => context._apiMethod) : [];
// Attach the names to the current request
// eslint-disable-next-line no-param-reassign
request.apiMethods = apiMethods;

function checkAuthResults(authResults) {
Expand Down
5 changes: 2 additions & 3 deletions lib/api/apiUtils/authorization/permissionChecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,10 @@ function checkIp(value) {
try {
try {
parseCIDR(values[i]);
} catch (err) {
} catch {
isValid(values[i]);
}
} catch (err) {
} catch {
return errString;
}

Expand Down Expand Up @@ -576,7 +576,6 @@ function validatePolicyConditions(policy) {
if (s.Condition) {
const conditionOperators = Object.keys(s.Condition);
// there can be multiple condition operations in the Condition enclosure
// eslint-disable-next-line no-restricted-syntax
for (const conditionOperator of conditionOperators) {
const conditionKey = Object.keys(s.Condition[conditionOperator])[0];
const conditionValue = s.Condition[conditionOperator][conditionKey];
Expand Down
7 changes: 0 additions & 7 deletions lib/api/apiUtils/authorization/prepareRequestContexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,6 @@ function prepareRequestContexts(apiMethod, request, sourceBucket,
generateRequestContext('objectPutTaggingVersion');
requestContexts.push(putObjectVersionRequestContext);
}
} else if (apiMethodAfterVersionCheck === 'objectPutCopyPart') {
const putObjectRequestContext =
generateRequestContext('objectPut');
requestContexts.push(putObjectRequestContext);
const getObjectRequestContext =
generateRequestContext('objectGet');
requestContexts.push(getObjectRequestContext);
} else if (apiMethodAfterVersionCheck === 'objectPut') {
// if put object with version
if (request.headers['x-scal-s3-version-id'] ||
Expand Down
1 change: 0 additions & 1 deletion lib/api/apiUtils/authorization/tagConditionKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ function updateRequestContextsWithTags(request, requestContexts, apiMethod, log,
return cb(err);
}
// FIXME introduced by CLDSRV-256, this syntax should be allowed by the linter
// eslint-disable-next-line no-restricted-syntax
for (const rc of requestContexts) {
rc.setNeedTagEval(true);
if (requestTagsQuery) {
Expand Down
2 changes: 0 additions & 2 deletions lib/api/apiUtils/bucket/parseWhere.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ function parseWhere(root) {
const e1 = parseWhere(root[operator][0]);
const e2 = parseWhere(root[operator][1]);

// eslint-disable-next-line
return { '$and' : [
e1,
e2,
Expand All @@ -62,7 +61,6 @@ function parseWhere(root) {
const e1 = parseWhere(root[operator][0]);
const e2 = parseWhere(root[operator][1]);

// eslint-disable-next-line
return { '$or' : [
e1,
e2,
Expand Down
Loading
Loading