ci: avoid potential hanging via hard limit (#1778)

* ci: avoid potential hanging via hard limit

* ci: remove build phase

* ci: print tmp_password for test
This commit is contained in:
Xiaochen Cui
2025-10-17 12:29:56 -07:00
committed by GitHub
parent 76dcdd4927
commit d7a0a81991
3 changed files with 29 additions and 23 deletions
-7
View File
@@ -44,13 +44,6 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Build
run: |
rm package-lock.json
npm install -g npm@latest
npm install
npm run test
- name: API Test
run: |
@@ -101,6 +101,9 @@ class DefaultUserService extends BaseService {
// console.log("************************************************");
// console.log('\n');
// NB: this is needed for the CI to extract the password
console.log(`password for admin is: ${tmp_password}`);
const realConsole = globalThis.original_console_object ?? console;
realConsole.log('\n');
svc_devConsole.notice({
+26 -16
View File
@@ -65,30 +65,40 @@ def init_server_config():
# create the admin user and print its password
def get_admin_password():
output_bytes, exit_code = cxc_toolkit.exec.run_command(
"npm start",
stream_output=False,
kill_on_output="password for admin",
# output_bytes, exit_code = cxc_toolkit.exec.run_command(
# "npm start",
# stream_output=False,
# kill_on_output="password for admin",
# )
backend_process = cxc_toolkit.exec.run_background(
"npm start", log_path="/tmp/backend.log"
)
# wait for the server to terminate
# NB: run_command + kill_on_output may wait indefinitely, use run_background + hard limit instead
time.sleep(10)
# print the line that contains "password"
lines = output_bytes.decode("utf-8", errors="ignore").splitlines()
admin_password = None
backend_process.terminate()
# read the log file
with open("/tmp/backend.log", "r") as f:
lines = f.readlines()
for line in lines:
if "password" in line:
if "password for admin" in line:
print(f"found password line: ---{line}---")
# Parse password from "password for admin is: bbb236b2"
if "password for admin is:" in line:
admin_password = line.split("password for admin is:")[1].strip()
print(f"Extracted admin password: {admin_password}")
break
admin_password = line.split("password for admin is:")[1].strip()
print(f"Extracted admin password: {admin_password}")
CONTEXT.ADMIN_PASSWORD = admin_password
return
print(f"password for admin: {admin_password}")
if not CONTEXT.ADMIN_PASSWORD:
print("Error: No admin password found")
CONTEXT.ADMIN_PASSWORD = admin_password
# print the log file
with open("/tmp/backend.log", "r") as f:
print(f.read())
exit(1)
def update_server_config():