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

Improvement/cldsrv 553 bump deps #5711

Open
wants to merge 21 commits into
base: development/9.0
Choose a base branch
from

Conversation

benzekrimaha
Copy link
Contributor

@benzekrimaha benzekrimaha commented Dec 6, 2024

Issue: CLDSRV-553

@bert-e
Copy link
Contributor

bert-e commented Dec 6, 2024

Hello benzekrimaha,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval
/bypass_build_status Bypass the build and test status
/bypass_commit_size Bypass the check on the size of the changeset TBA
/bypass_incompatible_branch Bypass the check on the source branch prefix
/bypass_jira_check Bypass the Jira issue check
/bypass_peer_approval Bypass the pull request peers' approval
/bypass_leader_approval Bypass the pull request leaders' approval
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request TBA
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@bert-e
Copy link
Contributor

bert-e commented Dec 6, 2024

Incorrect fix version

The Fix Version/s in issue CLDSRV-553 contains:

  • None

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 8.8.39

Please check the Fix Version/s of CLDSRV-553, or the target
branch of this pull request.

@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-553-bump-deps branch from dcc7c34 to 0eadb81 Compare December 6, 2024 15:59
@francoisferrand francoisferrand changed the base branch from development/8.8 to development/8.9 December 12, 2024 14:04
@bert-e
Copy link
Contributor

bert-e commented Dec 12, 2024

Incorrect fix version

The Fix Version/s in issue CLDSRV-553 contains:

  • None

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 8.9.0

Please check the Fix Version/s of CLDSRV-553, or the target
branch of this pull request.

Dockerfile Outdated Show resolved Hide resolved
Dockerfile Outdated
Comment on lines 25 to 27
RUN npm install -g node-gyp
COPY package.json yarn.lock /usr/src/app/
RUN npm install [email protected] -g
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

best to install all "global" packages in a single step,
before package.json copy (to avoid invalidatoin),
and specifying the node-gyp version (just like we do for typescript)

Suggested change
RUN npm install -g node-gyp
COPY package.json yarn.lock /usr/src/app/
RUN npm install [email protected] -g
RUN npm install -g \
[email protected] \
[email protected]
COPY package.json yarn.lock /usr/src/app/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-553-bump-deps branch 2 times, most recently from 15b93ac to 57325de Compare December 12, 2024 16:26
@benzekrimaha benzekrimaha marked this pull request as ready for review December 12, 2024 16:26
@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-553-bump-deps branch from 57325de to 2639bf6 Compare December 12, 2024 16:29
@bert-e
Copy link
Contributor

bert-e commented Dec 12, 2024

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

@scality scality deleted a comment from bert-e Dec 12, 2024
@benzekrimaha benzekrimaha force-pushed the improvement/CLDSRV-553-bump-deps branch from 8bb9b0a to b5e6e01 Compare December 12, 2024 16:49
lib/Config.js Outdated Show resolved Hide resolved
lib/utapi/utilities.js Outdated Show resolved Hide resolved
@@ -342,39 +342,6 @@ jobs:
source: /tmp/artifacts
if: always()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be skipped instead of removed:

Suggested change
utapi-v2-tests:
if: false

@francoisferrand
Copy link
Contributor

please rebase, there are conflicts.
(sorry, add some pending commensts, which may not be relevant anymore : please with this in mind...)

@@ -1,4 +0,0 @@
#!/usr/bin/env node
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should keep this file, and just add early return (if needed) in listMetrics()

#!/usr/bin/env node
'use strict'; // eslint-disable-line strict

require('../lib/utapi/utilities.js').listMetrics('buckets');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should keep this file, and just add early return (if needed) in listMetrics()

lib/Config.js Outdated Show resolved Hide resolved
lib/Config.js Outdated Show resolved Hide resolved
lib/Config.js Outdated Show resolved Hide resolved
@@ -1,5 +1,5 @@
const childProcess = require('child_process');
const Promise = require('bluebird');
const myPromise = require('bluebird');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename bluebirdPromise (or bbPromise).... or can we switch to using "standard" node.js Promise instead ?

@@ -1,6 +1,6 @@
const assert = require('assert');
const tv4 = require('tv4');
const Promise = require('bluebird');
const myPromise = require('bluebird');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -1,5 +1,5 @@
const assert = require('assert');
const process = require('process');
const myProcess = require('process');
Copy link
Contributor

@francoisferrand francoisferrand Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we switch to using the new standard process module?

const process = require('node:process');

@@ -1,5 +1,5 @@
const assert = require('assert');
const process = require('process');
const myProcess = require('process');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -31,7 +31,7 @@ const bigMD5 = '5f363e0e58a95f06cbe9bbc662c5dfb6';
const emptyMD5 = 'd41d8cd98f00b204e9800998ecf8427e';
const locMetaHeader = constants.objectLocationConstraintHeader.substring(11);

const Promise = require('bluebird');
const myPromise = require('bluebird');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use default Promise & promisify?

@@ -19,7 +19,7 @@ const body = Buffer.from('I am a body', 'utf8');
const correctMD5 = 'be747eb4b75517bf6b3cf7c5fbb62f3a';
const emptyMD5 = 'd41d8cd98f00b204e9800998ecf8427e';
const locMetaHeader = constants.objectLocationConstraintHeader.substring(11);
const Promise = require('bluebird');
const myPromise = require('bluebird');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use default Promise & promisify?

@@ -1,5 +1,5 @@
const assert = require('assert');
const crypto = require('crypto');
const myCrypto = require('crypto');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use default node:crypto ?

@@ -11,7 +11,7 @@ const { versioningEnabled } = require('../../../lib/utility/versioning-util');
const { describeSkipIfNotMultiple, getAwsRetry, awsLocation,
awsLocationEncryption, memLocation, fileLocation, genUniqID, isCEPH }
= require('../utils');
const Promise = require('bluebird');
const myPromise = require('bluebird');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -1,5 +1,5 @@
const assert = require('assert');
const crypto = require('crypto');
const myCrypto = require('crypto');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines 2 to 5
const myCrypto = require('crypto');

const Promise = require('bluebird');
const myPromise = require('bluebird');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

reject(result);
} else {
resolve(result);
(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this?

since the code is already async/wait, we can simply remove the outer Promise, and keep the function async:

const sendRequest = async (method, host, path, body = '', config = null) =>
    const service = 's3';
    const endpoint = new AWS.Endpoint(host);
   
    [...]
   
    const response = await nodeFetch(url, options);
    const text = await response.text();
    const result = await xml2js.parseStringPromise(text);
    if (result && result.Error) {
        throw result;
    }

    return result;
}

Comment on lines 100 to 103
after(() => {
mongoClient.close(true);
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mongodClient.close() is async (ie returns a Promise), so need to make the function passed to after async as well: too ensure it waits until mongo client is closed.

Suggested change
after(() => {
mongoClient.close(true);
});
after(() => mongoClient.close(true));

or

Suggested change
after(() => {
mongoClient.close(true);
});
after(async () => {
await mongoClient.close(true);
});

@@ -44,7 +44,7 @@ const updatedObjVal = { updated: true };
const runIfMongo =
process.env.S3METADATA === 'mongodb' ? describe : describe.skip;

function unescape(obj) {
function unescapeFunc(obj) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function unescapeFunc(obj) {
function unescapeJSON(obj) {

@@ -1,11 +1,11 @@
const crypto = require('crypto');
const myCrypto = require('crypto');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use node:crypto?


const proc = require('child_process');
const process = require('process');
const myProcess = require('process');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use node:process ?

Comment on lines 5 to 6
const myProcess = require('process');
const parseString = require('xml2js').parseString;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -1,7 +1,7 @@
const assert = require('assert');
const AWS = require('aws-sdk');
const async = require('async');
const crypto = require('crypto');
const myCrypto = require('crypto');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use node:crypto?

@@ -1,5 +1,5 @@
const assert = require('assert');
const crypto = require('crypto');
const myCrypto = require('crypto');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines 341 to 353
before(async () => {
const config = getConfig('default', { signatureVersion: 'v4', maxRetries: 0 });
s3Client = new S3(config);
scuba.start();
return metadata.setup(err => wait(2000, () => done(err)));
await new Promise((resolve, reject) => {
metadata.setup(err => {
if (err) {
reject(err);
}
wait(2000, resolve);
});
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
before(async () => {
const config = getConfig('default', { signatureVersion: 'v4', maxRetries: 0 });
s3Client = new S3(config);
scuba.start();
return metadata.setup(err => wait(2000, () => done(err)));
await new Promise((resolve, reject) => {
metadata.setup(err => {
if (err) {
reject(err);
}
wait(2000, resolve);
});
});
});
before(() => {
const config = getConfig('default', { signatureVersion: 'v4', maxRetries: 0 });
s3Client = new S3(config);
scuba.start();
return new Promise((resolve, reject) => {
metadata.setup(err => {
if (err) {
reject(err);
}
wait(2000, resolve);
});
});
});

isNFS: null,
isNFS: undefined,
};
const emptyReplicationMDUndef = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we put replicationInfo with isNFS: undefined : same (empty) fields are indeed not returned anymore (change in arsenal), but we did not change the way we write the metadata, so the "input" parameter of the tests should not change

Suggested change
const emptyReplicationMDUndef = {
isNFS: null,
};
const expectedEmptyReplicationMD = {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is failing otherwise waiting for undefined instead of nul

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we did not change the way we write the metadata, so the "input" parameter of the tests should not change

if the test fail, it is probably because we at some point compare to emptyReplicationMD instead of emptyReplicationMDUndef (which would be better renamed expectedEmptyReplicationMD I think)

@@ -470,7 +470,7 @@ describe('Config', () => {
process.env.S3_CONFIG_FILE = oldConfig;
});

it('should set up utapi local cache', () => {
it.skip('should set up utapi local cache', () => {
Copy link
Contributor

@francoisferrand francoisferrand Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should make linter fail : as it does not, it seems something is missing from the config :-(
so we'll need to think about adding it later...

Copy link
Contributor

@francoisferrand francoisferrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, but a few comments have not been adressed yet (esp. in gha)

Dockerfile Outdated
Comment on lines 25 to 27
RUN npm install -g node-gyp
COPY package.json yarn.lock /usr/src/app/
RUN npm install [email protected] -g
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

lib/Config.js Outdated Show resolved Hide resolved
lib/Config.js Outdated
} = require('../constants');
const { utapiVersion } = require('utapi');
// const { utapiVersion } = require('utapi');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"mock" the variable definition, so you don't need to add eslint-disable-line no-undef

Suggested change
// const { utapiVersion } = require('utapi');
const utapiVersion = 0; // require('utapi');

const sendRequest = async (method, host, path, body = '', config = null) =>
new Promise(async (resolve, reject) => {
const sendRequest = async (method, host, path, body = '', config = null) => {

const service = 's3';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • extra empty line
  • bad indent: should be just 4 spaces

return new Promise((resolve, reject) => {
metadata.setup(err => {
if (err) {
reject(err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing return

Comment on lines 346 to 352
metadata.setup(err => {
if (err) {
reject(err);
}
wait(2000, resolve);
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need to change the callback-based hook here?
as we are still using only callback-based functions internally, the updated code is more complex than the old one: if no constraint, may be better to keep it until those functions have been updated

isNFS: null,
isNFS: undefined,
};
const emptyReplicationMDUndef = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we did not change the way we write the metadata, so the "input" parameter of the tests should not change

if the test fail, it is probably because we at some point compare to emptyReplicationMD instead of emptyReplicationMDUndef (which would be better renamed expectedEmptyReplicationMD I think)

bucketUtil.emptyIfExists(BUCKET_FOR_NULL_VERSION)
.then(() => s3.createBucket({ Bucket: BUCKET_FOR_NULL_VERSION }).promise())
.then(() => done(), err => done(err))
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't understand how this code "waits" for the bucket to be created :(
(it would be the case if promise was returned, but i don't see how it is here...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants