@alwaysmeticulous/cli 2.257.1 → 2.259.0
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/dist/commands/download-test-run/download-test-run.command.d.ts +1 -1
- package/dist/commands/download-test-run/download-test-run.command.js +4 -1
- package/dist/commands/download-test-run/download-test-run.command.js.map +1 -1
- package/dist/commands/upload-assets-and-execute-test-run-in-cloud/upload-assets-and-execute-test-run-in-cloud.command.d.ts +16 -0
- package/dist/commands/upload-assets-and-execute-test-run-in-cloud/upload-assets-and-execute-test-run-in-cloud.command.js +55 -5
- package/dist/commands/upload-assets-and-execute-test-run-in-cloud/upload-assets-and-execute-test-run-in-cloud.command.js.map +1 -1
- package/dist/commands/upload-container-and-execute-test-run-in-cloud/upload-container-and-execute-test-run-in-cloud.command.d.ts +16 -0
- package/dist/commands/upload-container-and-execute-test-run-in-cloud/upload-container-and-execute-test-run-in-cloud.command.js +58 -8
- package/dist/commands/upload-container-and-execute-test-run-in-cloud/upload-container-and-execute-test-run-in-cloud.command.js.map +1 -1
- package/package.json +13 -13
|
@@ -10,7 +10,7 @@ export declare const downloadTestRunCommand: import("yargs").CommandModule<unkno
|
|
|
10
10
|
scope: {
|
|
11
11
|
string: true;
|
|
12
12
|
demandOption: false;
|
|
13
|
-
choices: ("everything" | "coverage-by-replay-pr-only" | "coverage-only" | "coverage-pr-only")[];
|
|
13
|
+
choices: ("everything" | "app-container-logs" | "coverage-by-replay-pr-only" | "coverage-only" | "coverage-pr-only")[];
|
|
14
14
|
default: string;
|
|
15
15
|
hidden: boolean;
|
|
16
16
|
};
|
|
@@ -5,7 +5,10 @@ const client_1 = require("@alwaysmeticulous/client");
|
|
|
5
5
|
const common_1 = require("@alwaysmeticulous/common");
|
|
6
6
|
const downloading_helpers_1 = require("@alwaysmeticulous/downloading-helpers");
|
|
7
7
|
const command_builder_1 = require("../../command-utils/command-builder");
|
|
8
|
-
const ALLOWED_SCOPES = [
|
|
8
|
+
const ALLOWED_SCOPES = [
|
|
9
|
+
"coverage-only",
|
|
10
|
+
"app-container-logs",
|
|
11
|
+
];
|
|
9
12
|
const handler = async ({ apiToken, testRunId, scope: _scope, }) => {
|
|
10
13
|
var _a;
|
|
11
14
|
const logger = (0, common_1.initLogger)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-test-run.command.js","sourceRoot":"","sources":["../../../src/commands/download-test-run/download-test-run.command.ts"],"names":[],"mappings":";;;AAAA,qDAAwD;AACxD,qDAAgF;AAChF,+EAI+C;AAC/C,yEAAmE;AAQnE,MAAM,cAAc,GAA2B,
|
|
1
|
+
{"version":3,"file":"download-test-run.command.js","sourceRoot":"","sources":["../../../src/commands/download-test-run/download-test-run.command.ts"],"names":[],"mappings":";;;AAAA,qDAAwD;AACxD,qDAAgF;AAChF,+EAI+C;AAC/C,yEAAmE;AAQnE,MAAM,cAAc,GAA2B;IAC7C,eAAe;IACf,oBAAoB;CACrB,CAAC;AAEF,MAAM,OAAO,GAAwC,KAAK,EAAE,EAC1D,QAAQ,EACR,SAAS,EACT,KAAK,EAAE,MAAM,GACd,EAAE,EAAE;;IACH,MAAM,MAAM,GAAG,IAAA,mBAAU,GAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE1C,MAAM,KAAK,GAAG,MAAC,MAA+B,mCAAI,eAAe,CAAC;IAElE,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACnC,IAAI,CAAC,iCAAwB,EAAE;YAC7B,MAAM,CAAC,KAAK,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;QACD,MAAM,CAAC,IAAI,CACT,uFAAuF,CACxF,CAAC;KACH;IAED,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,2CAAqB,EAC1D,MAAM,EACN,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,QAAQ,EACrB,KAAK,CACN,CAAC;IACF,MAAM,CAAC,IAAI,CAAC,gCAAgC,UAAU,EAAE,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEW,QAAA,sBAAsB,GAAG,IAAA,8BAAY,EAAC,mBAAmB,CAAC;KACpE,OAAO,CAAC;IACP,QAAQ,EAAE,gCAAgC;CAC3C,CAAC;KACD,OAAO,CAAC;IACP,QAAQ,EAAE;QACR,MAAM,EAAE,IAAI;KACb;IACD,SAAS,EAAE;QACT,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,QAAQ;KAClB;IACD,KAAK,EAAE;QACL,MAAM,EAAE,IAAI;QACZ,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,CAAC,GAAG,8CAAwB,CAAC;QACtC,OAAO,EAAE,eAAe;QACxB,MAAM,EAAE,CAAC,iCAAwB;KAClC;CACF,CAAC;KACD,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -6,6 +6,16 @@ export declare const uploadAssetsAndExecuteTestRunInCloudCommand: import("yargs"
|
|
|
6
6
|
readonly commitSha: {
|
|
7
7
|
readonly string: true;
|
|
8
8
|
};
|
|
9
|
+
readonly baseSha: {
|
|
10
|
+
readonly demandOption: false;
|
|
11
|
+
readonly string: true;
|
|
12
|
+
readonly description: "The base commit SHA to compare against. If not provided, inferred from --repoDirectory via merge-base with origin/main.";
|
|
13
|
+
};
|
|
14
|
+
readonly repoDirectory: {
|
|
15
|
+
readonly demandOption: false;
|
|
16
|
+
readonly string: true;
|
|
17
|
+
readonly description: "The path to the git repository to use for auto-detecting --commitSha and the base SHA.";
|
|
18
|
+
};
|
|
9
19
|
readonly appDirectory: {
|
|
10
20
|
readonly demandOption: false;
|
|
11
21
|
readonly string: true;
|
|
@@ -27,4 +37,10 @@ export declare const uploadAssetsAndExecuteTestRunInCloudCommand: import("yargs"
|
|
|
27
37
|
readonly default: true;
|
|
28
38
|
readonly description: "If true, the launcher will try to wait for a base test run to be created before triggering a test run. If that is not found, it will trigger a test run without waiting for a base test run.";
|
|
29
39
|
};
|
|
40
|
+
readonly waitForTestRunToComplete: {
|
|
41
|
+
readonly demandOption: false;
|
|
42
|
+
readonly boolean: true;
|
|
43
|
+
readonly default: false;
|
|
44
|
+
readonly description: "If true, block and wait until the triggered test run is complete, then report results. Implies --waitForBase.";
|
|
45
|
+
};
|
|
30
46
|
}>>;
|
|
@@ -24,15 +24,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.uploadAssetsAndExecuteTestRunInCloudCommand = void 0;
|
|
27
|
+
const client_1 = require("@alwaysmeticulous/client");
|
|
27
28
|
const common_1 = require("@alwaysmeticulous/common");
|
|
28
29
|
const remote_replay_launcher_1 = require("@alwaysmeticulous/remote-replay-launcher");
|
|
29
30
|
const Sentry = __importStar(require("@sentry/node"));
|
|
30
31
|
const command_builder_1 = require("../../command-utils/command-builder");
|
|
31
32
|
const common_options_1 = require("../../command-utils/common-options");
|
|
32
33
|
const out_of_date_client_error_1 = require("../../utils/out-of-date-client-error");
|
|
33
|
-
const
|
|
34
|
+
const POLL_INTERVAL_MS = 10000;
|
|
35
|
+
const handler = async ({ apiToken, commitSha: commitSha_, baseSha: baseSha_, repoDirectory, appDirectory, appZip, rewrites, waitForBase, waitForTestRunToComplete, }) => {
|
|
36
|
+
var _a, _b;
|
|
34
37
|
const logger = (0, common_1.initLogger)();
|
|
35
|
-
const
|
|
38
|
+
const gitOpts = repoDirectory ? { cwd: repoDirectory } : undefined;
|
|
39
|
+
const commitSha = await (0, common_1.getCommitSha)(commitSha_, gitOpts);
|
|
36
40
|
if (!appDirectory && !appZip) {
|
|
37
41
|
logger.error("No app directory or app zip provided, you must provide one with --appDirectory or --appZip");
|
|
38
42
|
process.exit(1);
|
|
@@ -41,22 +45,35 @@ const handler = async ({ apiToken, commitSha: commitSha_, appDirectory, appZip,
|
|
|
41
45
|
logger.error("No commit sha found, you must be in a git repository or provide one with --commitSha");
|
|
42
46
|
process.exit(1);
|
|
43
47
|
}
|
|
48
|
+
const baseSha = baseSha_ || (repoDirectory
|
|
49
|
+
? await (0, common_1.getLocalBaseSha)(gitOpts)
|
|
50
|
+
: undefined) || undefined;
|
|
51
|
+
if (baseSha && baseSha === commitSha) {
|
|
52
|
+
logger.info("Base SHA equals head SHA — nothing to test.");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
44
55
|
logger.info(`Uploading build artifacts for commit ${commitSha}`);
|
|
56
|
+
if (baseSha) {
|
|
57
|
+
logger.info(`Base SHA: ${baseSha}`);
|
|
58
|
+
}
|
|
45
59
|
Sentry.captureMessage("Received upload assets request", {
|
|
46
60
|
level: "debug",
|
|
47
61
|
extra: {
|
|
48
|
-
commitSha
|
|
62
|
+
commitSha,
|
|
49
63
|
},
|
|
50
64
|
});
|
|
65
|
+
let testRunId = null;
|
|
51
66
|
try {
|
|
52
|
-
await (0, remote_replay_launcher_1.uploadAssetsAndTriggerTestRun)({
|
|
67
|
+
const result = await (0, remote_replay_launcher_1.uploadAssetsAndTriggerTestRun)({
|
|
53
68
|
apiToken,
|
|
54
69
|
commitSha,
|
|
70
|
+
...(baseSha ? { baseSha } : {}),
|
|
55
71
|
appDirectory,
|
|
56
72
|
appZip,
|
|
57
73
|
rewrites: parseRewrites(rewrites),
|
|
58
|
-
waitForBase,
|
|
74
|
+
waitForBase: waitForBase || waitForTestRunToComplete,
|
|
59
75
|
});
|
|
76
|
+
testRunId = (_b = (_a = result.testRun) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null;
|
|
60
77
|
}
|
|
61
78
|
catch (error) {
|
|
62
79
|
if ((0, out_of_date_client_error_1.isOutOfDateClientError)(error)) {
|
|
@@ -66,6 +83,23 @@ const handler = async ({ apiToken, commitSha: commitSha_, appDirectory, appZip,
|
|
|
66
83
|
throw error;
|
|
67
84
|
}
|
|
68
85
|
}
|
|
86
|
+
if (!waitForTestRunToComplete || !testRunId) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const apiTokenToUse = (0, client_1.getApiToken)(apiToken);
|
|
90
|
+
if (!apiTokenToUse) {
|
|
91
|
+
logger.error("No API token found. Cannot wait for test run to complete.");
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
const client = (0, client_1.createClient)({ apiToken: apiTokenToUse });
|
|
95
|
+
logger.info(`Waiting for test run ${testRunId} to complete...`);
|
|
96
|
+
let completedTestRun = await (0, client_1.getTestRun)({ client, testRunId });
|
|
97
|
+
while (client_1.IN_PROGRESS_TEST_RUN_STATUS.includes(completedTestRun.status)) {
|
|
98
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
99
|
+
completedTestRun = await (0, client_1.getTestRun)({ client, testRunId });
|
|
100
|
+
logger.info(`Test run status: ${completedTestRun.status}`);
|
|
101
|
+
}
|
|
102
|
+
logger.info(`Test run ${testRunId} finished with status: ${completedTestRun.status}`);
|
|
69
103
|
};
|
|
70
104
|
const parseRewrites = (rewritesString) => {
|
|
71
105
|
const logger = (0, common_1.initLogger)();
|
|
@@ -102,6 +136,16 @@ exports.uploadAssetsAndExecuteTestRunInCloudCommand = (0, command_builder_1.buil
|
|
|
102
136
|
.options({
|
|
103
137
|
apiToken: common_options_1.OPTIONS.apiToken,
|
|
104
138
|
commitSha: common_options_1.OPTIONS.commitSha,
|
|
139
|
+
baseSha: {
|
|
140
|
+
demandOption: false,
|
|
141
|
+
string: true,
|
|
142
|
+
description: "The base commit SHA to compare against. If not provided, inferred from --repoDirectory via merge-base with origin/main.",
|
|
143
|
+
},
|
|
144
|
+
repoDirectory: {
|
|
145
|
+
demandOption: false,
|
|
146
|
+
string: true,
|
|
147
|
+
description: "The path to the git repository to use for auto-detecting --commitSha and the base SHA.",
|
|
148
|
+
},
|
|
105
149
|
appDirectory: {
|
|
106
150
|
demandOption: false,
|
|
107
151
|
string: true,
|
|
@@ -124,6 +168,12 @@ exports.uploadAssetsAndExecuteTestRunInCloudCommand = (0, command_builder_1.buil
|
|
|
124
168
|
default: true,
|
|
125
169
|
description: "If true, the launcher will try to wait for a base test run to be created before triggering a test run. If that is not found, it will trigger a test run without waiting for a base test run.",
|
|
126
170
|
},
|
|
171
|
+
waitForTestRunToComplete: {
|
|
172
|
+
demandOption: false,
|
|
173
|
+
boolean: true,
|
|
174
|
+
default: false,
|
|
175
|
+
description: "If true, block and wait until the triggered test run is complete, then report results. Implies --waitForBase.",
|
|
176
|
+
},
|
|
127
177
|
})
|
|
128
178
|
.handler(handler);
|
|
129
179
|
//# sourceMappingURL=upload-assets-and-execute-test-run-in-cloud.command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-assets-and-execute-test-run-in-cloud.command.js","sourceRoot":"","sources":["../../../src/commands/upload-assets-and-execute-test-run-in-cloud/upload-assets-and-execute-test-run-in-cloud.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"upload-assets-and-execute-test-run-in-cloud.command.js","sourceRoot":"","sources":["../../../src/commands/upload-assets-and-execute-test-run-in-cloud/upload-assets-and-execute-test-run-in-cloud.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAKkC;AAClC,qDAIkC;AAClC,qFAAyF;AACzF,qDAAuC;AACvC,yEAAmE;AACnE,uEAA6D;AAC7D,mFAG8C;AAE9C,MAAM,gBAAgB,GAAG,KAAM,CAAC;AAchC,MAAM,OAAO,GAAwC,KAAK,EAAE,EAC1D,QAAQ,EACR,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,QAAQ,EACjB,aAAa,EACb,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,WAAW,EACX,wBAAwB,GACzB,EAAE,EAAE;;IACH,MAAM,MAAM,GAAG,IAAA,mBAAU,GAAE,C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CAC9C;KACE,OAAO,CAAC;IACP,QAAQ,EACN,yEAAyE;CAC5E,CAAC;KACD,OAAO,CAAC;IACP,QAAQ,EAAE,wBAAO,CAAC,QAAQ;IAC1B,SAAS,EAAE,wBAAO,CAAC,SAAS;IAC5B,OAAO,EAAE;QACP,YAAY,EAAE,KAAK;QACnB,MAAM,EAAE,IAAI;QACZ,WAAW,EACT,yHAAyH;KAC5H;IACD,aAAa,EAAE;QACb,YAAY,EAAE,KAAK;QACnB,MAAM,EAAE,IAAI;QACZ,WAAW,EACT,wFAAwF;KAC3F;IACD,YAAY,EAAE;QACZ,YAAY,EAAE,KAAK;QACnB,MAAM,EAAE,IAAI;QACZ,WAAW,EACT,qGAAqG;KACxG;IACD,MAAM,EAAE;QACN,YAAY,EAAE,KAAK;QACnB,MAAM,EAAE,IAAI;QACZ,WAAW,EACT,0GAA0G;KAC7G;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,WAAW,EACT,mKAAmK;YACnK,6IAA6I;KAChJ;IACD,WAAW,EAAE;QACX,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,IAAI;QACb,WAAW,EACT,8LAA8L;KACjM;IACD,wBAAwB,EAAE;QACxB,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,KAAK;QACd,WAAW,EACT,+GAA+G;KAClH;CACO,CAAC;KACV,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -6,6 +6,16 @@ export declare const uploadContainerAndExecuteTestRunInCloudCommand: import("yar
|
|
|
6
6
|
readonly commitSha: {
|
|
7
7
|
readonly string: true;
|
|
8
8
|
};
|
|
9
|
+
readonly baseSha: {
|
|
10
|
+
readonly demandOption: false;
|
|
11
|
+
readonly string: true;
|
|
12
|
+
readonly description: "The base commit SHA to compare against. If not provided, inferred from --repoDirectory via merge-base with origin/main.";
|
|
13
|
+
};
|
|
14
|
+
readonly repoDirectory: {
|
|
15
|
+
readonly demandOption: false;
|
|
16
|
+
readonly string: true;
|
|
17
|
+
readonly description: "The path to the git repository to use for auto-detecting --commitSha and the base SHA.";
|
|
18
|
+
};
|
|
9
19
|
readonly localImageTag: {
|
|
10
20
|
readonly demandOption: true;
|
|
11
21
|
readonly string: true;
|
|
@@ -17,6 +27,12 @@ export declare const uploadContainerAndExecuteTestRunInCloudCommand: import("yar
|
|
|
17
27
|
readonly default: true;
|
|
18
28
|
readonly description: "If true, the launcher will try to wait for a base test run to be created before triggering a test run. If that is not found, it will trigger a test run without waiting for a base test run.";
|
|
19
29
|
};
|
|
30
|
+
readonly waitForTestRunToComplete: {
|
|
31
|
+
readonly demandOption: false;
|
|
32
|
+
readonly boolean: true;
|
|
33
|
+
readonly default: false;
|
|
34
|
+
readonly description: "If true, block and wait until the triggered test run is complete, then report results. Implies --waitForBase.";
|
|
35
|
+
};
|
|
20
36
|
readonly containerPort: {
|
|
21
37
|
readonly demandOption: false;
|
|
22
38
|
readonly number: true;
|
|
@@ -24,36 +24,53 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.uploadContainerAndExecuteTestRunInCloudCommand = void 0;
|
|
27
|
+
const client_1 = require("@alwaysmeticulous/client");
|
|
27
28
|
const common_1 = require("@alwaysmeticulous/common");
|
|
28
29
|
const remote_replay_launcher_1 = require("@alwaysmeticulous/remote-replay-launcher");
|
|
29
30
|
const Sentry = __importStar(require("@sentry/node"));
|
|
30
31
|
const command_builder_1 = require("../../command-utils/command-builder");
|
|
31
32
|
const common_options_1 = require("../../command-utils/common-options");
|
|
32
33
|
const out_of_date_client_error_1 = require("../../utils/out-of-date-client-error");
|
|
33
|
-
const
|
|
34
|
+
const POLL_INTERVAL_MS = 10000;
|
|
35
|
+
const handler = async ({ apiToken, commitSha: commitSha_, baseSha: baseSha_, repoDirectory, localImageTag, waitForBase, waitForTestRunToComplete, containerPort, containerEnv, }) => {
|
|
36
|
+
var _a, _b;
|
|
34
37
|
const logger = (0, common_1.initLogger)();
|
|
35
|
-
const
|
|
38
|
+
const gitOpts = repoDirectory ? { cwd: repoDirectory } : undefined;
|
|
39
|
+
const commitSha = await (0, common_1.getCommitSha)(commitSha_, gitOpts);
|
|
36
40
|
if (!commitSha) {
|
|
37
41
|
logger.error("No commit sha found, you must be in a git repository or provide one with --commitSha");
|
|
38
42
|
process.exit(1);
|
|
39
43
|
}
|
|
44
|
+
const baseSha = baseSha_ || (repoDirectory
|
|
45
|
+
? await (0, common_1.getLocalBaseSha)(gitOpts)
|
|
46
|
+
: undefined) || undefined;
|
|
47
|
+
if (baseSha && baseSha === commitSha) {
|
|
48
|
+
logger.info("Base SHA equals head SHA — nothing to test.");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
40
51
|
logger.info(`Uploading Docker container ${localImageTag} for commit ${commitSha}`);
|
|
52
|
+
if (baseSha) {
|
|
53
|
+
logger.info(`Base SHA: ${baseSha}`);
|
|
54
|
+
}
|
|
41
55
|
Sentry.captureMessage("Received upload container request", {
|
|
42
56
|
level: "debug",
|
|
43
57
|
extra: {
|
|
44
|
-
commitSha
|
|
45
|
-
localImageTag
|
|
58
|
+
commitSha,
|
|
59
|
+
localImageTag,
|
|
46
60
|
},
|
|
47
61
|
});
|
|
62
|
+
let testRunId = null;
|
|
48
63
|
try {
|
|
49
64
|
const result = await (0, remote_replay_launcher_1.uploadContainer)({
|
|
50
65
|
apiToken,
|
|
51
66
|
localImageTag,
|
|
52
67
|
commitSha,
|
|
53
|
-
|
|
68
|
+
...(baseSha ? { baseSha } : {}),
|
|
69
|
+
waitForBase: waitForBase || waitForTestRunToComplete,
|
|
54
70
|
containerPort,
|
|
55
71
|
containerEnv,
|
|
56
72
|
});
|
|
73
|
+
testRunId = (_b = (_a = result.testRun) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null;
|
|
57
74
|
if (!result.testRun) {
|
|
58
75
|
logger.warn("Container upload complete but test run not created");
|
|
59
76
|
}
|
|
@@ -66,6 +83,23 @@ const handler = async ({ apiToken, commitSha: commitSha_, localImageTag, waitFor
|
|
|
66
83
|
throw error;
|
|
67
84
|
}
|
|
68
85
|
}
|
|
86
|
+
if (!waitForTestRunToComplete || !testRunId) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const apiTokenToUse = (0, client_1.getApiToken)(apiToken);
|
|
90
|
+
if (!apiTokenToUse) {
|
|
91
|
+
logger.error("No API token found. Cannot wait for test run to complete.");
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
const client = (0, client_1.createClient)({ apiToken: apiTokenToUse });
|
|
95
|
+
logger.info(`Waiting for test run ${testRunId} to complete...`);
|
|
96
|
+
let completedTestRun = await (0, client_1.getTestRun)({ client, testRunId });
|
|
97
|
+
while (client_1.IN_PROGRESS_TEST_RUN_STATUS.includes(completedTestRun.status)) {
|
|
98
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
99
|
+
completedTestRun = await (0, client_1.getTestRun)({ client, testRunId });
|
|
100
|
+
logger.info(`Test run status: ${completedTestRun.status}`);
|
|
101
|
+
}
|
|
102
|
+
logger.info(`Test run ${testRunId} finished with status: ${completedTestRun.status}`);
|
|
69
103
|
};
|
|
70
104
|
exports.uploadContainerAndExecuteTestRunInCloudCommand = (0, command_builder_1.buildCommand)("upload-container-and-execute-test-run-in-cloud")
|
|
71
105
|
.details({
|
|
@@ -74,6 +108,16 @@ exports.uploadContainerAndExecuteTestRunInCloudCommand = (0, command_builder_1.b
|
|
|
74
108
|
.options({
|
|
75
109
|
apiToken: common_options_1.OPTIONS.apiToken,
|
|
76
110
|
commitSha: common_options_1.OPTIONS.commitSha,
|
|
111
|
+
baseSha: {
|
|
112
|
+
demandOption: false,
|
|
113
|
+
string: true,
|
|
114
|
+
description: "The base commit SHA to compare against. If not provided, inferred from --repoDirectory via merge-base with origin/main.",
|
|
115
|
+
},
|
|
116
|
+
repoDirectory: {
|
|
117
|
+
demandOption: false,
|
|
118
|
+
string: true,
|
|
119
|
+
description: "The path to the git repository to use for auto-detecting --commitSha and the base SHA.",
|
|
120
|
+
},
|
|
77
121
|
localImageTag: {
|
|
78
122
|
demandOption: true,
|
|
79
123
|
string: true,
|
|
@@ -85,6 +129,12 @@ exports.uploadContainerAndExecuteTestRunInCloudCommand = (0, command_builder_1.b
|
|
|
85
129
|
default: true,
|
|
86
130
|
description: "If true, the launcher will try to wait for a base test run to be created before triggering a test run. If that is not found, it will trigger a test run without waiting for a base test run.",
|
|
87
131
|
},
|
|
132
|
+
waitForTestRunToComplete: {
|
|
133
|
+
demandOption: false,
|
|
134
|
+
boolean: true,
|
|
135
|
+
default: false,
|
|
136
|
+
description: "If true, block and wait until the triggered test run is complete, then report results. Implies --waitForBase.",
|
|
137
|
+
},
|
|
88
138
|
containerPort: {
|
|
89
139
|
demandOption: false,
|
|
90
140
|
number: true,
|
|
@@ -95,11 +145,11 @@ exports.uploadContainerAndExecuteTestRunInCloudCommand = (0, command_builder_1.b
|
|
|
95
145
|
array: true,
|
|
96
146
|
coerce: (value) => value.map((v) => {
|
|
97
147
|
const [name, ...rest] = v.split("=");
|
|
98
|
-
const
|
|
99
|
-
if (!name || !
|
|
148
|
+
const envValue = rest.join("=");
|
|
149
|
+
if (!name || !envValue) {
|
|
100
150
|
throw new Error(`Invalid environment variable: ${v}`);
|
|
101
151
|
}
|
|
102
|
-
return { name, value };
|
|
152
|
+
return { name, value: envValue };
|
|
103
153
|
}),
|
|
104
154
|
description: "The environment variables to set in the container.",
|
|
105
155
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-container-and-execute-test-run-in-cloud.command.js","sourceRoot":"","sources":["../../../src/commands/upload-container-and-execute-test-run-in-cloud/upload-container-and-execute-test-run-in-cloud.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"upload-container-and-execute-test-run-in-cloud.command.js","sourceRoot":"","sources":["../../../src/commands/upload-container-and-execute-test-run-in-cloud/upload-container-and-execute-test-run-in-cloud.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAMkC;AAClC,qDAIkC;AAClC,qFAA2E;AAC3E,qDAAuC;AACvC,yEAAmE;AACnE,uEAA6D;AAC7D,mFAG8C;AAE9C,MAAM,gBAAgB,GAAG,KAAM,CAAC;AAchC,MAAM,OAAO,GAAwC,KAAK,EAAE,EAC1D,QAAQ,EACR,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,QAAQ,EACjB,aAAa,EACb,aAAa,EACb,WAAW,EACX,wBAAwB,EACxB,aAAa,EACb,YAAY,GACb,EAAE,EAAE;;IACH,MAAM,MAAM,GAAG,IAAA,mBAAU,GAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,MAAM,SAAS,GAAG,MAAM,IAAA,qBAAY,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAE1D,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,CAAC,KAAK,CACV,sFAAsF,CACvF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,MAAM,OAAO,GAAG,QAAQ,IAAI,CAAC,aAAa;QACxC,CAAC,CAAC,MAAM,IAAA,wBAAe,EAAC,OAAO,CAAC;QAChC,CAAC,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC;IAE5B,IAAI,OAAO,IAAI,OAAO,KAAK,SAAS,EAAE;QACpC,MAAM,CAAC,IAAI,CACT,6CAA6C,CAC9C,CAAC;QACF,OAAO;KACR;IAED,MAAM,CAAC,IAAI,CACT,8BAA8B,aAAa,eAAe,SAAS,EAAE,CACtE,CAAC;IACF,IAAI,OAAO,EAA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,KAAK;QACnB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,KAAK;QACd,WAAW,EACT,+GAA+G;KAClH;IACD,aAAa,EAAE;QACb,YAAY,EAAE,KAAK;QACnB,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,sCAAsC;KACpD;IACD,YAAY,EAAE;QACZ,YAAY,EAAE,KAAK;QACnB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,CAAC,KAAe,EAAE,EAAE,CAC1B,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAChC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACtB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,EAAE,CAAC,CAAC;aACvD;YACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;QACnC,CAAC,CAAC;QACJ,WAAW,EAAE,oDAAoD;KAClE;CACO,CAAC;KACV,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwaysmeticulous/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.259.0",
|
|
4
4
|
"description": "The Meticulous CLI",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"depcheck": "depcheck --ignore-patterns=dist"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@alwaysmeticulous/api": "2.
|
|
33
|
-
"@alwaysmeticulous/client": "2.
|
|
34
|
-
"@alwaysmeticulous/common": "2.
|
|
35
|
-
"@alwaysmeticulous/downloading-helpers": "2.
|
|
36
|
-
"@alwaysmeticulous/record": "2.
|
|
37
|
-
"@alwaysmeticulous/remote-replay-launcher": "2.
|
|
38
|
-
"@alwaysmeticulous/replay-debugger-ui": "2.
|
|
39
|
-
"@alwaysmeticulous/replay-orchestrator-launcher": "2.
|
|
40
|
-
"@alwaysmeticulous/sdk-bundles-api": "2.
|
|
41
|
-
"@alwaysmeticulous/sentry": "2.
|
|
42
|
-
"@alwaysmeticulous/tunnels-client": "2.
|
|
32
|
+
"@alwaysmeticulous/api": "2.259.0",
|
|
33
|
+
"@alwaysmeticulous/client": "2.259.0",
|
|
34
|
+
"@alwaysmeticulous/common": "2.259.0",
|
|
35
|
+
"@alwaysmeticulous/downloading-helpers": "2.259.0",
|
|
36
|
+
"@alwaysmeticulous/record": "2.259.0",
|
|
37
|
+
"@alwaysmeticulous/remote-replay-launcher": "2.259.0",
|
|
38
|
+
"@alwaysmeticulous/replay-debugger-ui": "2.259.0",
|
|
39
|
+
"@alwaysmeticulous/replay-orchestrator-launcher": "2.259.0",
|
|
40
|
+
"@alwaysmeticulous/sdk-bundles-api": "2.259.0",
|
|
41
|
+
"@alwaysmeticulous/sentry": "2.259.0",
|
|
42
|
+
"@alwaysmeticulous/tunnels-client": "2.259.0",
|
|
43
43
|
"@sentry/node": "^10.3.0",
|
|
44
44
|
"chalk": "^4.1.2",
|
|
45
45
|
"ci-info": "^4.0.0",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"bugs": {
|
|
72
72
|
"url": "https://github.com/alwaysmeticulous/meticulous-sdk/issues"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "92a9eb21cc6e9f19b5c322581e45a08b23376c3c"
|
|
75
75
|
}
|