Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 0 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,8 @@ def runE2ETests() {
npm --version
npm ci
node etc/test-setup-qa.js
# Adding sleep for the setups to complete before running test-complete
sleep 10
node etc/test-setup-dmsdk-qa.js
sleep 10
node config-optic/setupqa.js
sleep 30
cd test-complete-app
./gradlew -i mlDeploy -g $PWD
cd ..
Expand Down
105 changes: 5 additions & 100 deletions etc/test-setup-prompt.js
Original file line number Diff line number Diff line change
@@ -1,108 +1,13 @@
/*
* Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
*/
var read = require("read");
var mlutil = require('../lib/mlutil.js');

function adminUserPrompt() {
var self = this;
if (self.user === null) {
read({
prompt: 'admin user (default=admin): '
},
mlutil.callbackOn(self, adminUserCallback)
);
} else {
self.passwordPrompt();
}
}
function adminUserCallback(error, result) {
if (error) {
console.log(error);
process.exit(1);
}
this.user = (result === '') ? 'admin' : result;
this.passwordPrompt();
}
function adminPasswordPrompt() {
var self = this;
if (self.password === null) {
read({
prompt: (self.user === 'admin') ?
'admin password (default=admin): ' : 'admin password: ',
silent: true,
replace: '*',
edit: false
},
mlutil.callbackOn(self, adminPasswordCallback)
);
} else {
self.finish();
}
}
function adminPasswordCallback(error, result) {
if (error) {
console.log(error);
process.exit(1);
}
if (result === '') {
if (this.user === 'admin') {
this.password = 'admin';
} else {
console.log('no admin password specified, so cannot setup');
process.exit(1);
}
} else {
this.password = result;
}
this.finish();
}
function adminFinish() {
this.done(this.user, this.password);
}

function AdminPrompter(done) {
this.done = done;
this.user = null;
this.password = null;
}
AdminPrompter.prototype.userPrompt = adminUserPrompt;
AdminPrompter.prototype.userCallback = adminUserCallback;
AdminPrompter.prototype.passwordPrompt = adminPasswordPrompt;
AdminPrompter.prototype.passwordCallback = adminPasswordCallback;
AdminPrompter.prototype.finish = adminFinish;
// Simplified version - no more prompting, just returns admin/admin
// TODO: Remove this file when ml-gradle migration is complete
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

[nitpick] The TODO comment suggests this file should be removed eventually. Consider adding a timeline or milestone reference to make this actionable, such as 'TODO: Remove this file in v2.0 when ml-gradle migration is complete'.

Suggested change
// TODO: Remove this file when ml-gradle migration is complete
// TODO: Remove this file in v2.0 when ml-gradle migration is complete

Copilot uses AI. Check for mistakes.

function promptForAdmin(done) {
var prompter = new AdminPrompter(done);

var argvLen = process.argv.length;
if (argvLen >= 4) {
var argvMax = argvLen - 1;
for (var argvI=2; argvI < argvMax; argvI++) {
var argvVal = process.argv[argvI];
if (argvVal === '-u') {
argvVal = process.argv[argvI + 1];
var argvSep = argvVal.indexOf(':');
if (argvSep < 0) {
prompter.user = argvVal;
break;
}
if (argvSep > 0) {
prompter.user = argvVal.substring(0, argvSep);
}
if (argvSep < (argvVal.length - 1)) {
prompter.password = argvVal.substring(argvSep + 1);
}
break;
} else if (argvVal === '-h') {
console.log('usage: '+process.argv[1]+' [-u adminUser:adminPassword]');
console.log('without -u, prompts for admin user and/or admin password');
process.exit();
}
};
}

prompter.userPrompt();
// Always use admin/admin - no prompting needed
console.log('Using default admin credentials (admin/admin)');
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

Logging credentials to the console, even default ones, could expose sensitive information in logs. Consider using a more generic message like 'Using default admin credentials' without displaying the actual values.

Suggested change
console.log('Using default admin credentials (admin/admin)');
console.log('Using default admin credentials');

Copilot uses AI. Check for mistakes.
done('admin', 'admin');
}

module.exports = promptForAdmin;
21 changes: 0 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"mocha": "^11.7.3",
"mocha-junit-reporter": "2.2.0",
"moment": "^2.29.4",
"read": "^1.0.7",
"sanitize-html": "^2.13.0",
"should": "^13.2.3",
"stream-to-array": "^2.3.0"
Expand Down