@resolveio/server-lib 22.3.78 → 22.3.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -6,6 +6,8 @@ export interface ResolveIORunnerQaToolBundleOptions {
|
|
|
6
6
|
jobId?: string;
|
|
7
7
|
ownerId?: string;
|
|
8
8
|
runnerToken?: string;
|
|
9
|
+
mongoRuntimePath?: string;
|
|
10
|
+
qaLiveDataRequired?: boolean;
|
|
9
11
|
toolsBinPath?: string;
|
|
10
12
|
browserslistPath?: string;
|
|
11
13
|
mongodbBinaryCachePath?: string;
|
|
@@ -29,6 +29,8 @@ function buildResolveIORunnerQaEnvScript(options) {
|
|
|
29
29
|
var jobId = shellDoubleQuote(options.jobId || '');
|
|
30
30
|
var ownerId = shellDoubleQuote(options.ownerId || '');
|
|
31
31
|
var runnerToken = shellDoubleQuote(options.runnerToken || '');
|
|
32
|
+
var mongoRuntimePath = shellDoubleQuote(options.mongoRuntimePath || '');
|
|
33
|
+
var qaLiveDataRequired = options.qaLiveDataRequired === true ? 'true' : 'false';
|
|
32
34
|
var toolsBinPath = options.toolsBinPath || '';
|
|
33
35
|
var browserslistPath = options.browserslistPath || '';
|
|
34
36
|
var mongodbBinaryCachePath = options.mongodbBinaryCachePath || '';
|
|
@@ -122,6 +124,12 @@ function buildResolveIORunnerQaEnvScript(options) {
|
|
|
122
124
|
"export ".concat(envVar(altMode, 'OWNER_ID'), "=\"").concat('${' + envVar(altMode, 'OWNER_ID') + ':-${' + envVar(mode, 'OWNER_ID') + '}}', "\""),
|
|
123
125
|
"export ".concat(envVar(mode, 'RUNNER_TOKEN'), "=\"").concat('${' + envVar(mode, 'RUNNER_TOKEN') + ':-${' + envVar(altMode, 'RUNNER_TOKEN') + ':-' + runnerToken + '}}', "\""),
|
|
124
126
|
"export ".concat(envVar(altMode, 'RUNNER_TOKEN'), "=\"").concat('${' + envVar(altMode, 'RUNNER_TOKEN') + ':-${' + envVar(mode, 'RUNNER_TOKEN') + '}}', "\""),
|
|
127
|
+
mongoRuntimePath ? "export ".concat(envVar(mode, 'MONGO_RUNTIME_PATH'), "=\"").concat('${' + envVar(mode, 'MONGO_RUNTIME_PATH') + ':-${' + envVar(altMode, 'MONGO_RUNTIME_PATH') + ':-' + mongoRuntimePath + '}}', "\"") : '',
|
|
128
|
+
mongoRuntimePath ? "export ".concat(envVar(altMode, 'MONGO_RUNTIME_PATH'), "=\"").concat('${' + envVar(altMode, 'MONGO_RUNTIME_PATH') + ':-${' + envVar(mode, 'MONGO_RUNTIME_PATH') + '}}', "\"") : '',
|
|
129
|
+
mongoRuntimePath ? "export RESOLVEIO_QA_MONGO_RUNTIME_PATH=\"".concat('${RESOLVEIO_QA_MONGO_RUNTIME_PATH:-$' + envVar(mode, 'MONGO_RUNTIME_PATH') + '}', "\"") : '',
|
|
130
|
+
"export ".concat(envVar(mode, 'LIVE_DATA_REQUIRED'), "=\"").concat('${' + envVar(mode, 'LIVE_DATA_REQUIRED') + ':-${' + envVar(altMode, 'LIVE_DATA_REQUIRED') + ':-' + qaLiveDataRequired + '}}', "\""),
|
|
131
|
+
"export ".concat(envVar(altMode, 'LIVE_DATA_REQUIRED'), "=\"").concat('${' + envVar(altMode, 'LIVE_DATA_REQUIRED') + ':-${' + envVar(mode, 'LIVE_DATA_REQUIRED') + '}}', "\""),
|
|
132
|
+
"export RESOLVEIO_QA_LIVE_DATA_REQUIRED=\"".concat('${RESOLVEIO_QA_LIVE_DATA_REQUIRED:-$' + envVar(mode, 'LIVE_DATA_REQUIRED') + '}', "\""),
|
|
125
133
|
'export PUPPETEER_CACHE_DIR="${PUPPETEER_CACHE_DIR:-/var/lib/resolveio/puppeteer}"',
|
|
126
134
|
'if [ ! -d "$PUPPETEER_CACHE_DIR" ] || [ ! -w "$PUPPETEER_CACHE_DIR" ]; then',
|
|
127
135
|
' export PUPPETEER_CACHE_DIR="$RESOLVEIO_QA_TMP/puppeteer"',
|
|
@@ -242,6 +250,15 @@ function buildResolveIORunnerLocalQaScript() {
|
|
|
242
250
|
' kill_tree "$pid"',
|
|
243
251
|
' done',
|
|
244
252
|
'}',
|
|
253
|
+
'kill_local_mongo_processes() {',
|
|
254
|
+
' local mongo_port="$MONGO_PORT"',
|
|
255
|
+
' [ -n "$mongo_port" ] || return 0',
|
|
256
|
+
' for pid in $(ps -eo pid=,args= | awk -v port="$mongo_port" \'$0 !~ /awk -v port=/ && $0 !~ /ps -eo pid=,args=/ && $0 ~ /mongod/ && $0 ~ ("--port " port) && ($0 ~ /\\/tmp\\/resolveio-support-qa\\/.*mongod/ || $0 ~ /--dbpath mongo\\/data\\/db/) {print $1}\' 2>/dev/null || true); do',
|
|
257
|
+
' skip_cleanup_pid "$pid" && continue',
|
|
258
|
+
' [ "$pid" = "$$" ] && continue',
|
|
259
|
+
' kill_tree "$pid"',
|
|
260
|
+
' done',
|
|
261
|
+
'}',
|
|
245
262
|
'RUNNER_ANCESTOR_PIDS=" $$ ${PPID:-} "',
|
|
246
263
|
'ancestor_pid="${PPID:-}"',
|
|
247
264
|
'while [ -n "$ancestor_pid" ] && [ "$ancestor_pid" != "0" ] && [ "$ancestor_pid" != "1" ]; do',
|
|
@@ -263,6 +280,7 @@ function buildResolveIORunnerLocalQaScript() {
|
|
|
263
280
|
' for port in "$CLIENT_PORT" "$SERVER_PORT" "$MONGO_PORT" "$INSPECT_PORT"; do kill_port_listeners "$port"; done',
|
|
264
281
|
' kill_env_marked_processes',
|
|
265
282
|
' kill_artifact_log_writers',
|
|
283
|
+
' kill_local_mongo_processes',
|
|
266
284
|
' for pid in $(ps -eo pid=,args= | awk -v root="$PROJECT_ROOT" \'index($0, root) && $0 !~ /awk -v root=/ && $0 !~ /ps -eo pid=,args=/ && $0 !~ /run-local-qa\\.sh|stop-local-qa\\.sh|bugfix-comparison-qa\\.sh/ && $0 ~ /(ng serve|node .*node_modules\\/\\.bin\\/ng|esbuild|npm run client|start_client\\.sh|npm run server|start_server\\.sh|nodemon|node .*tmp\\/index\\.js|mongod|mongodb-binaries\\/mongod)/ {print $1}\' 2>/dev/null || true); do',
|
|
267
285
|
' skip_cleanup_pid "$pid" && continue',
|
|
268
286
|
' kill_tree "$pid"',
|
|
@@ -306,6 +324,7 @@ function buildResolveIORunnerLocalQaScript() {
|
|
|
306
324
|
' done',
|
|
307
325
|
' fi',
|
|
308
326
|
' kill_artifact_log_writers',
|
|
327
|
+
' kill_local_mongo_processes',
|
|
309
328
|
' for pid in $(ps -eo pid=,args= | awk -v root="$PROJECT_ROOT" \'index($0, root) && $0 !~ /awk -v root=/ && $0 !~ /ps -eo pid=,args=/ && $0 !~ /run-local-qa\\.sh|stop-local-qa\\.sh|bugfix-comparison-qa\\.sh/ && $0 ~ /(ng serve|node .*node_modules\\/\\.bin\\/ng|esbuild|npm run client|start_client\\.sh|npm run server|start_server\\.sh|nodemon|node .*tmp\\/index\\.js|mongod|mongodb-binaries\\/mongod)/ {print $1}\' 2>/dev/null || true); do',
|
|
310
329
|
' skip_cleanup_pid "$pid" && continue',
|
|
311
330
|
' found=1',
|
|
@@ -570,6 +589,16 @@ function buildResolveIORunnerLocalQaStopperScript() {
|
|
|
570
589
|
' killed_count=$((killed_count + 1))',
|
|
571
590
|
' done',
|
|
572
591
|
'}',
|
|
592
|
+
'kill_local_mongo_processes() {',
|
|
593
|
+
' local mongo_port="$MONGO_PORT"',
|
|
594
|
+
' [ -n "$mongo_port" ] || return 0',
|
|
595
|
+
' for pid in $(ps -eo pid=,args= | awk -v port="$mongo_port" \'$0 !~ /awk -v port=/ && $0 !~ /ps -eo pid=,args=/ && $0 ~ /mongod/ && $0 ~ ("--port " port) && ($0 ~ /\\/tmp\\/resolveio-support-qa\\/.*mongod/ || $0 ~ /--dbpath mongo\\/data\\/db/) {print $1}\' 2>/dev/null || true); do',
|
|
596
|
+
' skip_cleanup_pid "$pid" && continue',
|
|
597
|
+
' [ "$pid" = "$$" ] && continue',
|
|
598
|
+
' kill_tree "$pid"',
|
|
599
|
+
' killed_count=$((killed_count + 1))',
|
|
600
|
+
' done',
|
|
601
|
+
'}',
|
|
573
602
|
'RUNNER_ANCESTOR_PIDS=" $$ ${PPID:-} "',
|
|
574
603
|
'ancestor_pid="${PPID:-}"',
|
|
575
604
|
'while [ -n "$ancestor_pid" ] && [ "$ancestor_pid" != "0" ] && [ "$ancestor_pid" != "1" ]; do',
|
|
@@ -593,6 +622,7 @@ function buildResolveIORunnerLocalQaStopperScript() {
|
|
|
593
622
|
' for port in "$CLIENT_PORT" "$SERVER_PORT" "$MONGO_PORT" "$INSPECT_PORT"; do kill_port_listeners "$port"; done',
|
|
594
623
|
' kill_env_marked_processes',
|
|
595
624
|
' kill_artifact_log_writers',
|
|
625
|
+
' kill_local_mongo_processes',
|
|
596
626
|
' for pid in $(ps -eo pid=,args= | awk -v root="$PROJECT_ROOT" \'index($0, root) && $0 !~ /awk -v root=/ && $0 !~ /ps -eo pid=,args=/ && $0 !~ /run-local-qa\\.sh|stop-local-qa\\.sh|bugfix-comparison-qa\\.sh/ && $0 ~ /(ng serve|node .*node_modules\\/\\.bin\\/ng|esbuild|npm run client|start_client\\.sh|npm run server|start_server\\.sh|nodemon|node .*tmp\\/index\\.js|mongod|mongodb-binaries\\/mongod)/ {print $1}\' 2>/dev/null || true); do',
|
|
597
627
|
' skip_cleanup_pid "$pid" && continue',
|
|
598
628
|
' kill_tree "$pid"',
|
|
@@ -637,6 +667,7 @@ function buildResolveIORunnerLocalQaStopperScript() {
|
|
|
637
667
|
' done',
|
|
638
668
|
' fi',
|
|
639
669
|
' kill_artifact_log_writers',
|
|
670
|
+
' kill_local_mongo_processes',
|
|
640
671
|
' for pid in $(ps -eo pid=,args= | awk -v root="$PROJECT_ROOT" \'index($0, root) && $0 !~ /awk -v root=/ && $0 !~ /ps -eo pid=,args=/ && $0 !~ /run-local-qa\\.sh|stop-local-qa\\.sh|bugfix-comparison-qa\\.sh/ && $0 ~ /(ng serve|node .*node_modules\\/\\.bin\\/ng|esbuild|npm run client|start_client\\.sh|npm run server|start_server\\.sh|nodemon|node .*tmp\\/index\\.js|mongod|mongodb-binaries\\/mongod)/ {print $1}\' 2>/dev/null || true); do',
|
|
641
672
|
' skip_cleanup_pid "$pid" && continue',
|
|
642
673
|
' found=1',
|
|
@@ -689,7 +720,15 @@ function buildResolveIORunnerQaLiveDataSeederScript() {
|
|
|
689
720
|
' const envUri = process.env.RESOLVEIO_QA_LIVE_MONGO_URL || process.env.RESOLVEIO_SUPPORT_QA_LIVE_MONGO_URL || process.env.RESOLVEIO_RUNNER_QA_LIVE_MONGO_URL || "";',
|
|
690
721
|
' const envDb = process.env.RESOLVEIO_QA_LIVE_MONGO_DB || process.env.RESOLVEIO_SUPPORT_QA_LIVE_MONGO_DB || process.env.RESOLVEIO_RUNNER_QA_LIVE_MONGO_DB || "";',
|
|
691
722
|
' if (envUri) return { uri: envUri, database: envDb };',
|
|
723
|
+
' const explicitRuntimePaths = [',
|
|
724
|
+
' process.env.RESOLVEIO_QA_MONGO_RUNTIME_PATH,',
|
|
725
|
+
' process.env.RESOLVEIO_SUPPORT_QA_MONGO_RUNTIME_PATH,',
|
|
726
|
+
' process.env.RESOLVEIO_RUNNER_QA_MONGO_RUNTIME_PATH',
|
|
727
|
+
' ].map((value) => String(value || "").trim()).filter(Boolean);',
|
|
692
728
|
' const candidates = [',
|
|
729
|
+
' ...explicitRuntimePaths,',
|
|
730
|
+
' path.join(repoRoot, "mongo-context", ".mongo-runtime.json"),',
|
|
731
|
+
' path.join(projectRoot, "mongo-context", ".mongo-runtime.json"),',
|
|
693
732
|
' path.join(repoRoot, ".resolveio-support-context", "mongo-context", ".mongo-runtime.json"),',
|
|
694
733
|
' path.join(projectRoot, ".resolveio-support-context", "mongo-context", ".mongo-runtime.json"),',
|
|
695
734
|
' path.join(repoRoot, ".resolveio-context", "mongo-context", ".mongo-runtime.json"),',
|
|
@@ -710,6 +749,10 @@ function buildResolveIORunnerQaLiveDataSeederScript() {
|
|
|
710
749
|
' return /mongodb(?:\\+srv)?:\\/\\/(?:[^@/]+@)?(?:127\\.0\\.0\\.1|localhost)(?::\\d+)?\\//i.test(String(uri || ""));',
|
|
711
750
|
'}',
|
|
712
751
|
'',
|
|
752
|
+
'function isLiveDataRequired() {',
|
|
753
|
+
' return /^(true|1|yes|on)$/i.test(String(process.env.RESOLVEIO_QA_LIVE_DATA_REQUIRED || process.env.RESOLVEIO_SUPPORT_QA_LIVE_DATA_REQUIRED || process.env.RESOLVEIO_RUNNER_QA_LIVE_DATA_REQUIRED || ""));',
|
|
754
|
+
'}',
|
|
755
|
+
'',
|
|
713
756
|
'function requireMongo() {',
|
|
714
757
|
' const candidates = [',
|
|
715
758
|
' path.join(projectRoot, "server", "node_modules", "mongodb"),',
|
|
@@ -952,7 +995,7 @@ function buildResolveIORunnerQaLiveDataSeederScript() {
|
|
|
952
995
|
' const { MongoClient } = requireMongo();',
|
|
953
996
|
' const source = resolveRuntimeSource();',
|
|
954
997
|
' const targetUri = process.env.RESOLVEIO_SUPPORT_QA_MONGO_URL || process.env.RESOLVEIO_RUNNER_QA_MONGO_URL || process.env.MONGO_URL || "mongodb://127.0.0.1:3001/resolveio?directConnection=true";',
|
|
955
|
-
' if (!source.uri) writeResult({ status: "skipped", reason: "missing_live_mongo_uri", result_path: resultPath }, 0);',
|
|
998
|
+
' if (!source.uri) writeResult({ status: isLiveDataRequired() ? "failed" : "skipped", reason: "missing_live_mongo_uri", required: isLiveDataRequired(), result_path: resultPath }, isLiveDataRequired() ? 5 : 0);',
|
|
956
999
|
' if (!isLocalMongoUri(targetUri)) writeResult({ status: "failed", reason: "target_mongo_must_be_localhost", target_uri_redacted: redactUri(targetUri), result_path: resultPath }, 3);',
|
|
957
1000
|
' if (String(source.uri) === String(targetUri)) writeResult({ status: "failed", reason: "source_and_target_mongo_match", result_path: resultPath }, 3);',
|
|
958
1001
|
' const sourceClient = new MongoClient(source.uri, { readPreference: "secondaryPreferred", serverSelectionTimeoutMS: 15000 });',
|