eas-cli 26.0.0 → 27.2.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/README.md +293 -148
- package/build/analytics/AnalyticsManager.d.ts +2 -0
- package/build/analytics/AnalyticsManager.js +2 -0
- package/build/build/build.d.ts +1 -2
- package/build/build/build.js +9 -4
- package/build/build/errors.d.ts +2 -0
- package/build/build/errors.js +4 -1
- package/build/build/evaluateConfigWithEnvVarsAsync.js +1 -3
- package/build/build/freeTierNearLimitAgentUpdatesTip.d.ts +98 -0
- package/build/build/freeTierNearLimitAgentUpdatesTip.js +205 -0
- package/build/build/runBuildAndSubmit.d.ts +2 -0
- package/build/build/runBuildAndSubmit.js +3 -0
- package/build/build/simulatorsLaunchHint.d.ts +7 -0
- package/build/build/simulatorsLaunchHint.js +40 -0
- package/build/build/utils/expoTokenRole.d.ts +4 -0
- package/build/build/utils/expoTokenRole.js +14 -0
- package/build/commandUtils/EasCommand.js +3 -3
- package/build/commandUtils/context/contextUtils/findProjectDirAndVerifyProjectSetupAsync.js +2 -1
- package/build/commandUtils/workflow/referencedFiles.d.ts +6 -0
- package/build/commandUtils/workflow/referencedFiles.js +63 -0
- package/build/commandUtils/workflow/types.d.ts +1 -1
- package/build/commandUtils/workflow/utils.js +34 -5
- package/build/commands/account/login.js +6 -0
- package/build/commands/account/view.d.ts +0 -7
- package/build/commands/account/view.js +4 -74
- package/build/commands/build/index.js +8 -1
- package/build/commands/observe/session.js +4 -3
- package/build/commands/observe/trace.d.ts +17 -0
- package/build/commands/observe/trace.js +58 -0
- package/build/commands/observe/traces.d.ts +33 -0
- package/build/commands/observe/traces.js +159 -0
- package/build/commands/simulator/control.js +41 -6
- package/build/commands/simulator/logs.d.ts +22 -0
- package/build/commands/simulator/logs.js +188 -0
- package/build/commands/workflow/cancel.js +9 -20
- package/build/commands/workflow/run.js +9 -0
- package/build/commands/workflow/runs.js +1 -1
- package/build/graphql/generated.d.ts +698 -5
- package/build/graphql/generated.js +25 -4
- package/build/graphql/mutations/UserPreferenceMutation.d.ts +5 -0
- package/build/graphql/mutations/UserPreferenceMutation.js +24 -0
- package/build/graphql/mutations/WorkflowRevisionMutation.d.ts +3 -2
- package/build/graphql/mutations/WorkflowRevisionMutation.js +12 -3
- package/build/graphql/queries/AccountQuery.d.ts +3 -1
- package/build/graphql/queries/AccountQuery.js +54 -0
- package/build/graphql/queries/ObserveQuery.d.ts +24 -1
- package/build/graphql/queries/ObserveQuery.js +114 -1
- package/build/graphql/queries/UserPreferenceQuery.d.ts +8 -0
- package/build/graphql/queries/UserPreferenceQuery.js +28 -0
- package/build/graphql/queries/WorkflowRunQuery.js +6 -0
- package/build/graphql/types/Observe.d.ts +1 -0
- package/build/graphql/types/Observe.js +53 -1
- package/build/graphql/types/WorkflowRun.js +1 -0
- package/build/help.js +13 -6
- package/build/log.d.ts +2 -0
- package/build/log.js +10 -0
- package/build/observe/fetchSessions.d.ts +12 -1
- package/build/observe/fetchSessions.js +39 -2
- package/build/observe/fetchSpans.d.ts +27 -0
- package/build/observe/fetchSpans.js +36 -0
- package/build/observe/formatSessions.d.ts +3 -1
- package/build/observe/formatSessions.js +40 -3
- package/build/observe/formatSpans.d.ts +110 -0
- package/build/observe/formatSpans.js +250 -0
- package/build/observe/spanFilters.d.ts +5 -0
- package/build/observe/spanFilters.js +32 -0
- package/build/project/projectStatus.js +1 -0
- package/build/simulator/artifacts.d.ts +9 -0
- package/build/simulator/artifacts.js +97 -0
- package/build/simulator/download.d.ts +2 -0
- package/build/simulator/download.js +57 -0
- package/build/simulator/events.js +2 -10
- package/build/simulator/preview.d.ts +26 -0
- package/build/simulator/preview.js +156 -0
- package/build/simulator/utils.d.ts +5 -0
- package/build/simulator/utils.js +42 -0
- package/build/user/accountPermissions.d.ts +11 -0
- package/build/user/accountPermissions.js +89 -0
- package/oclif.manifest.json +920 -422
- package/package.json +6 -6
- package/build/build/freeTierLimitGuidance.d.ts +0 -19
- package/build/build/freeTierLimitGuidance.js +0 -39
|
@@ -113,7 +113,7 @@ class SimulatorControl extends EasCommand_1.default {
|
|
|
113
113
|
}
|
|
114
114
|
printCatalog(catalog, jsonFlag) {
|
|
115
115
|
if (jsonFlag) {
|
|
116
|
-
(0, json_1.printJsonOnlyOutput)(catalog);
|
|
116
|
+
(0, json_1.printJsonOnlyOutput)(Object.fromEntries(Object.entries(catalog).map(([name, entry]) => [name, withUploadPathHelp(entry)])));
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
const names = Object.keys(catalog).sort();
|
|
@@ -129,7 +129,7 @@ class SimulatorControl extends EasCommand_1.default {
|
|
|
129
129
|
}
|
|
130
130
|
printActionHelp(action, entry, jsonFlag) {
|
|
131
131
|
if (jsonFlag) {
|
|
132
|
-
(0, json_1.printJsonOnlyOutput)({ ...entry, action });
|
|
132
|
+
(0, json_1.printJsonOnlyOutput)({ ...withUploadPathHelp(entry), action });
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
135
|
log_1.default.newLine();
|
|
@@ -156,6 +156,11 @@ class SimulatorControl extends EasCommand_1.default {
|
|
|
156
156
|
log_1.default.newLine();
|
|
157
157
|
log_1.default.log(' Action arguments refer to the simulator host. Use --output for the local filename.');
|
|
158
158
|
}
|
|
159
|
+
const uploadHelp = uploadPathHelp(entry);
|
|
160
|
+
if (uploadHelp) {
|
|
161
|
+
log_1.default.newLine();
|
|
162
|
+
log_1.default.log(` ${uploadHelp}`);
|
|
163
|
+
}
|
|
159
164
|
log_1.default.newLine();
|
|
160
165
|
}
|
|
161
166
|
async runActionAsync(connection, entry, { sessionId, action, values, outputPath, jsonFlag, }) {
|
|
@@ -212,18 +217,48 @@ class SimulatorControl extends EasCommand_1.default {
|
|
|
212
217
|
}
|
|
213
218
|
}
|
|
214
219
|
exports.default = SimulatorControl;
|
|
215
|
-
|
|
220
|
+
function uploadPathHelp(entry) {
|
|
221
|
+
if (!entry.upload) {
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
return entry.uploadAs === 'id'
|
|
225
|
+
? 'This action requires a local file to upload. host: paths are not supported.'
|
|
226
|
+
: 'File paths are local. Use host:/absolute/path for files on the simulator host.';
|
|
227
|
+
}
|
|
228
|
+
function withUploadPathHelp(entry) {
|
|
229
|
+
const help = uploadPathHelp(entry);
|
|
230
|
+
return help
|
|
231
|
+
? { ...entry, description: [entry.description, help].filter(Boolean).join('\n\n') }
|
|
232
|
+
: entry;
|
|
233
|
+
}
|
|
234
|
+
async function findLocalUploadAsync({ upload: param, uploadWhen = {}, uploadAs }, params) {
|
|
216
235
|
const value = param ? params[param] : undefined;
|
|
217
236
|
const applies = Object.entries(uploadWhen).every(([name, expected]) => params[name] === expected);
|
|
218
237
|
if (!param || typeof value !== 'string' || !applies) {
|
|
219
238
|
return null;
|
|
220
239
|
}
|
|
221
|
-
|
|
240
|
+
if (value.startsWith('host:')) {
|
|
241
|
+
if (uploadAs === 'id') {
|
|
242
|
+
throw new Error('This action requires a local file to upload; host: paths are not supported.');
|
|
243
|
+
}
|
|
244
|
+
const hostPath = value.slice('host:'.length);
|
|
245
|
+
if (!path_1.default.posix.isAbsolute(hostPath)) {
|
|
246
|
+
throw new Error(`A host: path must be absolute, for example host:/tmp/app.tar.gz. For a local filename beginning with host:, use ./${value}.`);
|
|
247
|
+
}
|
|
248
|
+
params[param] = hostPath;
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
const stat = await fs.stat(value).catch((error) => {
|
|
252
|
+
if (error.code === 'ENOENT' || error.code === 'ENOTDIR') {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
throw error;
|
|
256
|
+
});
|
|
222
257
|
if (stat?.isDirectory()) {
|
|
223
258
|
throw new Error(`${value} is a folder. Pass the path of a file.`);
|
|
224
259
|
}
|
|
225
|
-
if (!stat
|
|
226
|
-
throw new Error(`${value} does not exist on this computer. Pass
|
|
260
|
+
if (!stat) {
|
|
261
|
+
throw new Error(`${value} does not exist on this computer. Pass a local file, or prefix an absolute simulator-host path with host:.`);
|
|
227
262
|
}
|
|
228
263
|
return stat ? { param, path: value } : null;
|
|
229
264
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
export default class SimulatorLogs extends EasCommand {
|
|
3
|
+
static aliases: string[];
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
artifact: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
follow: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
scope: import("@oclif/core/lib/interfaces").OptionFlag<"all" | "user-apps", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
limit: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
timestamp: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
};
|
|
17
|
+
static contextDefinition: {
|
|
18
|
+
projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
|
|
19
|
+
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
20
|
+
};
|
|
21
|
+
runAsync(): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
6
|
+
const flags_1 = require("../../commandUtils/flags");
|
|
7
|
+
const generated_1 = require("../../graphql/generated");
|
|
8
|
+
const DeviceRunSessionQuery_1 = require("../../graphql/queries/DeviceRunSessionQuery");
|
|
9
|
+
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
10
|
+
const artifacts_1 = require("../../simulator/artifacts");
|
|
11
|
+
const env_1 = require("../../simulator/env");
|
|
12
|
+
const preview_1 = require("../../simulator/preview");
|
|
13
|
+
const utils_1 = require("../../simulator/utils");
|
|
14
|
+
const json_1 = require("../../utils/json");
|
|
15
|
+
// serve-sim keeps sending heartbeats while its log source restarts, so the stream alone cannot show a failure.
|
|
16
|
+
const LOG_SOURCE_HEALTH_CHECK_INTERVAL_MS = 10_000;
|
|
17
|
+
class SimulatorLogs extends EasCommand_1.default {
|
|
18
|
+
static aliases = ['sim:logs'];
|
|
19
|
+
static description = '[EXPERIMENTAL] show buffered logs from a remote iOS simulator session';
|
|
20
|
+
static examples = [
|
|
21
|
+
'<%= config.bin %> simulator:logs --follow',
|
|
22
|
+
'<%= config.bin %> simulator:logs --json',
|
|
23
|
+
];
|
|
24
|
+
static flags = {
|
|
25
|
+
id: core_1.Flags.string({
|
|
26
|
+
description: `Simulator session ID. Defaults to ${env_1.SIMULATOR_DOTENV_FILE_NAME}.`,
|
|
27
|
+
}),
|
|
28
|
+
artifact: core_1.Flags.integer({
|
|
29
|
+
min: 1,
|
|
30
|
+
description: 'Artifact index to download from a stopped session (1-based).',
|
|
31
|
+
}),
|
|
32
|
+
output: core_1.Flags.string({
|
|
33
|
+
char: 'o',
|
|
34
|
+
description: 'Save a stopped session artifact to this path.',
|
|
35
|
+
}),
|
|
36
|
+
follow: core_1.Flags.boolean({
|
|
37
|
+
char: 'f',
|
|
38
|
+
description: 'Stream new logs. Start following before performing actions to collect them.',
|
|
39
|
+
exclusive: ['json'],
|
|
40
|
+
}),
|
|
41
|
+
scope: core_1.Flags.option({
|
|
42
|
+
description: 'Show user app logs or all device logs while the session runs.',
|
|
43
|
+
options: ['user-apps', 'all'],
|
|
44
|
+
default: 'user-apps',
|
|
45
|
+
})(),
|
|
46
|
+
limit: core_1.Flags.integer({
|
|
47
|
+
description: 'Maximum number of buffered log lines to show while the session runs.',
|
|
48
|
+
default: 100,
|
|
49
|
+
min: 1,
|
|
50
|
+
}),
|
|
51
|
+
timestamp: core_1.Flags.boolean({
|
|
52
|
+
description: 'Show timestamps in live human-readable log output.',
|
|
53
|
+
}),
|
|
54
|
+
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
55
|
+
};
|
|
56
|
+
static contextDefinition = {
|
|
57
|
+
...this.ContextOptions.LoggedIn,
|
|
58
|
+
...this.ContextOptions.ProjectDir,
|
|
59
|
+
};
|
|
60
|
+
async runAsync() {
|
|
61
|
+
// Before parsing, so only the JSON result reaches stdout.
|
|
62
|
+
if (this.argv.includes('--json')) {
|
|
63
|
+
(0, json_1.enableJsonOutput)();
|
|
64
|
+
}
|
|
65
|
+
const { flags } = await this.parse(SimulatorLogs);
|
|
66
|
+
const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
|
|
67
|
+
const { projectDir, loggedIn: { graphqlClient }, } = await this.getContextAsync(SimulatorLogs, { nonInteractive });
|
|
68
|
+
await (0, env_1.loadSimulatorEnvAsync)(projectDir);
|
|
69
|
+
const deviceRunSessionId = flags.id ?? process.env[env_1.EAS_SIMULATOR_SESSION_ID];
|
|
70
|
+
if (!deviceRunSessionId) {
|
|
71
|
+
throw new Error(`No simulator session ID provided. Pass --id, or run \`eas simulator:start\` first to write ${env_1.SIMULATOR_DOTENV_FILE_NAME}.`);
|
|
72
|
+
}
|
|
73
|
+
const session = await DeviceRunSessionQuery_1.DeviceRunSessionQuery.byIdAsync(graphqlClient, deviceRunSessionId);
|
|
74
|
+
if ((0, artifacts_1.hasSimulatorArtifacts)(session)) {
|
|
75
|
+
if (flags.follow) {
|
|
76
|
+
throw new Error('The session has stopped. --follow is only available while it runs. Use --output <path> to download its logs artifact.');
|
|
77
|
+
}
|
|
78
|
+
await (0, artifacts_1.downloadSimulatorArtifactAsync)(session, 'simulator-log', {
|
|
79
|
+
artifact: flags.artifact,
|
|
80
|
+
output: flags.output,
|
|
81
|
+
nonInteractive,
|
|
82
|
+
json: jsonFlag,
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (session.platform === generated_1.AppPlatform.Android) {
|
|
87
|
+
throw new Error('Live logs are only available for iOS simulator sessions. This session runs an Android emulator, whose preview server does not stream logs. Start an iOS session with `eas simulator:start --platform ios` to read logs.');
|
|
88
|
+
}
|
|
89
|
+
const preview = await (0, preview_1.resolveSimulatorPreviewAsync)(session);
|
|
90
|
+
if (flags.artifact !== undefined || flags.output !== undefined) {
|
|
91
|
+
throw new Error('--artifact and --output are only available for stopped sessions. To save live logs, follow them into a file: `eas simulator:logs --follow > logs.txt`.');
|
|
92
|
+
}
|
|
93
|
+
const query = { scope: flags.scope, limit: String(flags.limit) };
|
|
94
|
+
if (flags.follow) {
|
|
95
|
+
const abortController = new AbortController();
|
|
96
|
+
const interruptHandler = () => {
|
|
97
|
+
if (abortController.signal.aborted) {
|
|
98
|
+
process.exit(130);
|
|
99
|
+
}
|
|
100
|
+
abortController.abort();
|
|
101
|
+
};
|
|
102
|
+
process.on('SIGINT', interruptHandler);
|
|
103
|
+
const stopHealthChecks = watchLogSourceHealth(preview, flags.scope, abortController.signal);
|
|
104
|
+
try {
|
|
105
|
+
await (0, preview_1.streamSimulatorPreviewAsync)(preview, '/logs', data => {
|
|
106
|
+
log_1.default.log(flags.timestamp ? formatLogEnvelope(data) : (0, utils_1.formatLogLine)(data));
|
|
107
|
+
}, {
|
|
108
|
+
query: { ...query, ...(flags.timestamp ? { envelope: '1' } : {}) },
|
|
109
|
+
signal: abortController.signal,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
stopHealthChecks();
|
|
114
|
+
process.removeListener('SIGINT', interruptHandler);
|
|
115
|
+
}
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const snapshot = await (0, preview_1.fetchSimulatorPreviewJsonAsync)(preview, '/logs', {
|
|
119
|
+
query: { ...query, snapshot: '1' },
|
|
120
|
+
});
|
|
121
|
+
if (!jsonFlag && snapshot.streamError) {
|
|
122
|
+
log_1.default.warn((0, utils_1.stripTerminalControlCharacters)(snapshot.streamError));
|
|
123
|
+
}
|
|
124
|
+
if (jsonFlag) {
|
|
125
|
+
(0, json_1.printJsonOnlyOutput)({ deviceRunSessionId: preview.deviceRunSessionId, ...snapshot });
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (snapshot.lines.length === 0) {
|
|
129
|
+
// The warning above already explains why the buffer can be empty.
|
|
130
|
+
if (!snapshot.streamError) {
|
|
131
|
+
log_1.default.log('No buffered logs. Use --follow to collect logs before performing actions.');
|
|
132
|
+
}
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
for (const line of snapshot.lines) {
|
|
136
|
+
log_1.default.log((0, utils_1.formatLogLine)(line.raw, flags.timestamp, line.at));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.default = SimulatorLogs;
|
|
141
|
+
function formatLogEnvelope(data) {
|
|
142
|
+
let line;
|
|
143
|
+
try {
|
|
144
|
+
line = JSON.parse(data);
|
|
145
|
+
}
|
|
146
|
+
catch { }
|
|
147
|
+
return typeof line?.raw === 'string' && (0, utils_1.isValidLogTime)(line.at)
|
|
148
|
+
? (0, utils_1.formatLogLine)(line.raw, true, line.at)
|
|
149
|
+
: (0, utils_1.formatLogLine)(data);
|
|
150
|
+
}
|
|
151
|
+
/** Polls the log source while following and reports when it stops or recovers. Returns a stop function. */
|
|
152
|
+
function watchLogSourceHealth(preview, scope, signal) {
|
|
153
|
+
let failing = false;
|
|
154
|
+
let checking = false;
|
|
155
|
+
const checkAsync = async () => {
|
|
156
|
+
checking = true;
|
|
157
|
+
try {
|
|
158
|
+
const { status, streamError } = await (0, preview_1.fetchSimulatorPreviewJsonAsync)(preview, '/logs', { query: { scope, limit: '1', snapshot: '1' } });
|
|
159
|
+
if (signal.aborted) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (!failing && status !== 'streaming') {
|
|
163
|
+
failing = true;
|
|
164
|
+
const reason = streamError ? `: ${(0, utils_1.stripTerminalControlCharacters)(streamError)}` : '';
|
|
165
|
+
// stderr, so the notice stays out of `--follow > logs.txt`.
|
|
166
|
+
log_1.default.warnToStderr(`Simulator logs are not being collected. The session's log source stopped${reason}. It restarts automatically, and logs from this gap are missing.`);
|
|
167
|
+
}
|
|
168
|
+
else if (failing && status === 'streaming' && !streamError) {
|
|
169
|
+
failing = false;
|
|
170
|
+
log_1.default.warnToStderr('Simulator log collection resumed.');
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
// The stream itself reports connection failures.
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
checking = false;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const timer = setInterval(() => {
|
|
181
|
+
if (!checking) {
|
|
182
|
+
void checkAsync();
|
|
183
|
+
}
|
|
184
|
+
}, LOG_SOURCE_HEALTH_CHECK_INTERVAL_MS);
|
|
185
|
+
return () => {
|
|
186
|
+
clearInterval(timer);
|
|
187
|
+
};
|
|
188
|
+
}
|
|
@@ -10,7 +10,7 @@ const AppQuery_1 = require("../../graphql/queries/AppQuery");
|
|
|
10
10
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
11
11
|
const prompts_1 = require("../../prompts");
|
|
12
12
|
class WorkflowRunCancel extends EasCommand_1.default {
|
|
13
|
-
static description = 'cancel one or more workflow runs. If no workflow run IDs are provided, you will be prompted to select
|
|
13
|
+
static description = 'cancel one or more workflow runs. If no workflow run IDs are provided, you will be prompted to select in-progress or queued runs to cancel';
|
|
14
14
|
static strict = false;
|
|
15
15
|
static contextDefinition = {
|
|
16
16
|
...this.ContextOptions.ProjectId,
|
|
@@ -20,21 +20,10 @@ class WorkflowRunCancel extends EasCommand_1.default {
|
|
|
20
20
|
...flags_1.EASNonInteractiveFlag,
|
|
21
21
|
};
|
|
22
22
|
async runAsync() {
|
|
23
|
-
const { argv } = await this.parse(WorkflowRunCancel);
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
const tokens = [...argv];
|
|
28
|
-
while (tokens.length > 0) {
|
|
29
|
-
const token = tokens.shift();
|
|
30
|
-
if (token === '--non-interactive') {
|
|
31
|
-
nonInteractive = true;
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
else if (token) {
|
|
35
|
-
workflowRunIds.add(token);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
23
|
+
const { argv, flags } = await this.parse(WorkflowRunCancel);
|
|
24
|
+
// oclif removes declared flags such as --non-interactive from argv.
|
|
25
|
+
const nonInteractive = flags['non-interactive'];
|
|
26
|
+
const workflowRunIds = new Set(argv);
|
|
38
27
|
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(WorkflowRunCancel, {
|
|
39
28
|
nonInteractive,
|
|
40
29
|
});
|
|
@@ -42,9 +31,9 @@ class WorkflowRunCancel extends EasCommand_1.default {
|
|
|
42
31
|
if (nonInteractive) {
|
|
43
32
|
throw new Error('Must supply workflow run IDs as arguments when in non-interactive mode');
|
|
44
33
|
}
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
const runs = (0, utils_1.processWorkflowRuns)(
|
|
34
|
+
const pickerStatuses = [generated_1.WorkflowRunStatus.InProgress, generated_1.WorkflowRunStatus.Waiting];
|
|
35
|
+
const runsByStatus = await Promise.all(pickerStatuses.map(status => AppQuery_1.AppQuery.byIdWorkflowRunsFilteredByStatusAsync(graphqlClient, projectId, status, 50)));
|
|
36
|
+
const runs = (0, utils_1.processWorkflowRuns)(runsByStatus.flat());
|
|
48
37
|
if (runs.length === 0) {
|
|
49
38
|
log_1.default.warn('No workflow runs to cancel');
|
|
50
39
|
return;
|
|
@@ -52,7 +41,7 @@ class WorkflowRunCancel extends EasCommand_1.default {
|
|
|
52
41
|
const answers = await (0, prompts_1.promptAsync)({
|
|
53
42
|
type: 'multiselect',
|
|
54
43
|
name: 'selectedRuns',
|
|
55
|
-
message: 'Select
|
|
44
|
+
message: 'Select workflow runs to cancel',
|
|
56
45
|
choices: runs.map(run => (0, utils_1.choiceFromWorkflowRun)(run)),
|
|
57
46
|
});
|
|
58
47
|
answers.selectedRuns.forEach((id) => {
|
|
@@ -54,6 +54,7 @@ const url_1 = require("../../build/utils/url");
|
|
|
54
54
|
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
55
55
|
const flags_1 = require("../../commandUtils/flags");
|
|
56
56
|
const inputs_1 = require("../../commandUtils/workflow/inputs");
|
|
57
|
+
const referencedFiles_1 = require("../../commandUtils/workflow/referencedFiles");
|
|
57
58
|
const utils_1 = require("../../commandUtils/workflow/utils");
|
|
58
59
|
const generated_1 = require("../../graphql/generated");
|
|
59
60
|
const WorkflowRevisionMutation_1 = require("../../graphql/mutations/WorkflowRevisionMutation");
|
|
@@ -138,6 +139,7 @@ class WorkflowRun extends EasCommand_1.default {
|
|
|
138
139
|
let workflowRunId;
|
|
139
140
|
let workflowRevisionId;
|
|
140
141
|
let gitRef;
|
|
142
|
+
let referencedFiles;
|
|
141
143
|
if (flags.ref) {
|
|
142
144
|
// Run from git ref
|
|
143
145
|
const fileName = path.basename(args.file);
|
|
@@ -181,12 +183,18 @@ class WorkflowRun extends EasCommand_1.default {
|
|
|
181
183
|
log_1.default.error('Failed to read workflow file.');
|
|
182
184
|
throw err;
|
|
183
185
|
}
|
|
186
|
+
referencedFiles = await (0, referencedFiles_1.collectReferencedWorkflowFilesAsync)({
|
|
187
|
+
projectDir,
|
|
188
|
+
rootFileName: path.basename(args.file),
|
|
189
|
+
rootYamlConfig: yamlConfig,
|
|
190
|
+
});
|
|
184
191
|
}
|
|
185
192
|
// Validate workflow YAML
|
|
186
193
|
try {
|
|
187
194
|
await WorkflowRevisionMutation_1.WorkflowRevisionMutation.validateWorkflowYamlConfigAsync(graphqlClient, {
|
|
188
195
|
appId: projectId,
|
|
189
196
|
yamlConfig,
|
|
197
|
+
referencedFiles,
|
|
190
198
|
});
|
|
191
199
|
}
|
|
192
200
|
catch (error) {
|
|
@@ -287,6 +295,7 @@ class WorkflowRun extends EasCommand_1.default {
|
|
|
287
295
|
workflowRevisionInput: {
|
|
288
296
|
fileName: path.basename(args.file),
|
|
289
297
|
yamlConfig,
|
|
298
|
+
referencedFiles,
|
|
290
299
|
},
|
|
291
300
|
workflowRunInput: {
|
|
292
301
|
inputs,
|
|
@@ -61,7 +61,7 @@ class WorkflowRunList extends EasCommand_1.default {
|
|
|
61
61
|
{ label: 'Workflow', value: run.workflowFileName },
|
|
62
62
|
{ label: 'Status', value: run.status },
|
|
63
63
|
{ label: 'Started At', value: run.startedAt },
|
|
64
|
-
{ label: 'Finished At', value: run.finishedAt },
|
|
64
|
+
{ label: 'Finished At', value: run.finishedAt ?? 'null' },
|
|
65
65
|
{ label: 'Trigger Type', value: run.triggerType },
|
|
66
66
|
{ label: 'Trigger', value: run.trigger ?? 'null' },
|
|
67
67
|
{ label: 'Git Commit Message', value: run.gitCommitMessage ?? 'null' },
|