eas-cli 23.1.0 → 23.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 +170 -147
- package/build/api.d.ts +1 -0
- package/build/api.js +12 -0
- package/build/commandUtils/workflow/logs/fetchLogs.d.ts +5 -0
- package/build/commandUtils/workflow/logs/fetchLogs.js +24 -0
- package/build/commandUtils/workflow/logs/parseLogs.d.ts +14 -0
- package/build/commandUtils/workflow/logs/parseLogs.js +69 -0
- package/build/commandUtils/workflow/logs/watcher.d.ts +32 -0
- package/build/commandUtils/workflow/logs/watcher.js +162 -0
- package/build/commandUtils/workflow/stateMachine.js +2 -1
- package/build/commandUtils/workflow/types.d.ts +12 -5
- package/build/commandUtils/workflow/utils.d.ts +9 -5
- package/build/commandUtils/workflow/utils.js +144 -146
- package/build/commands/simulator/get.js +2 -0
- package/build/commands/simulator/index.d.ts +1 -0
- package/build/commands/simulator/index.js +10 -0
- package/build/commands/simulator/list.d.ts +1 -0
- package/build/commands/simulator/list.js +9 -0
- package/build/commands/workflow/run.d.ts +8 -0
- package/build/commands/workflow/run.js +27 -0
- package/build/commands/workflow/ssh.d.ts +31 -0
- package/build/commands/workflow/ssh.js +190 -0
- package/build/graphql/generated.d.ts +243 -3
- package/build/graphql/generated.js +28 -4
- package/build/graphql/mutations/RealtimeLogsMutation.d.ts +6 -0
- package/build/graphql/mutations/RealtimeLogsMutation.js +40 -0
- package/build/graphql/mutations/WorkflowRunMutation.d.ts +3 -2
- package/build/graphql/mutations/WorkflowRunMutation.js +4 -1
- package/build/graphql/queries/DeviceRunSessionQuery.js +5 -0
- package/build/graphql/queries/WorkflowJobSshQuery.d.ts +20 -0
- package/build/graphql/queries/WorkflowJobSshQuery.js +133 -0
- package/build/ora.d.ts +7 -0
- package/build/ora.js +12 -0
- package/build/simulator/utils.js +9 -1
- package/build/utils/centrifuge.d.ts +10 -0
- package/build/utils/centrifuge.js +89 -0
- package/build/utils/expodash/uniqBy.js +3 -2
- package/oclif.manifest.json +936 -833
- package/package.json +5 -2
- package/build/commandUtils/workflow/fetchLogs.d.ts +0 -6
- package/build/commandUtils/workflow/fetchLogs.js +0 -44
|
@@ -6,23 +6,26 @@ exports.choiceFromWorkflowRun = choiceFromWorkflowRun;
|
|
|
6
6
|
exports.choiceFromWorkflowJob = choiceFromWorkflowJob;
|
|
7
7
|
exports.choicesFromWorkflowLogs = choicesFromWorkflowLogs;
|
|
8
8
|
exports.processWorkflowRuns = processWorkflowRuns;
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
9
|
+
exports.logsForFailedWorkflowRunAsync = logsForFailedWorkflowRunAsync;
|
|
10
|
+
exports.formatActiveWorkflowRun = formatActiveWorkflowRun;
|
|
11
|
+
exports.formatFailedWorkflowRun = formatFailedWorkflowRun;
|
|
12
12
|
exports.fileExistsAsync = fileExistsAsync;
|
|
13
13
|
exports.maybeReadStdinAsync = maybeReadStdinAsync;
|
|
14
14
|
exports.showWorkflowStatusAsync = showWorkflowStatusAsync;
|
|
15
15
|
const tslib_1 = require("tslib");
|
|
16
16
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
17
17
|
const fs = tslib_1.__importStar(require("node:fs"));
|
|
18
|
-
const
|
|
18
|
+
const parseLogs_1 = require("./logs/parseLogs");
|
|
19
19
|
const types_1 = require("./types");
|
|
20
20
|
const generated_1 = require("../../graphql/generated");
|
|
21
|
+
const watcher_1 = require("./logs/watcher");
|
|
21
22
|
const WorkflowRunQuery_1 = require("../../graphql/queries/WorkflowRunQuery");
|
|
22
23
|
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
23
24
|
const ora_1 = require("../../ora");
|
|
24
25
|
const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
|
|
26
|
+
const centrifuge_1 = require("../../utils/centrifuge");
|
|
25
27
|
const promise_1 = require("../../utils/promise");
|
|
28
|
+
const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
|
|
26
29
|
function computeTriggerInfoForWorkflowRun(run) {
|
|
27
30
|
let triggerType = types_1.WorkflowTriggerType.OTHER;
|
|
28
31
|
let trigger = '';
|
|
@@ -75,16 +78,13 @@ function choiceFromWorkflowJob(job, index) {
|
|
|
75
78
|
}
|
|
76
79
|
function choicesFromWorkflowLogs(logs) {
|
|
77
80
|
return Array.from(logs.values())
|
|
78
|
-
.map(({ key, label, logLines }) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
logLines,
|
|
86
|
-
};
|
|
87
|
-
})
|
|
81
|
+
.map(({ key, label, result, logLines }) => ({
|
|
82
|
+
title: `${label} - ${result ?? ''}`,
|
|
83
|
+
name: label,
|
|
84
|
+
status: result ?? '',
|
|
85
|
+
value: key,
|
|
86
|
+
logLines,
|
|
87
|
+
}))
|
|
88
88
|
.filter(step => step.status !== 'skipped');
|
|
89
89
|
}
|
|
90
90
|
function processWorkflowRuns(runs) {
|
|
@@ -106,48 +106,6 @@ function processWorkflowRuns(runs) {
|
|
|
106
106
|
};
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
async function fetchAndProcessLogsFromJobAsync(state, job) {
|
|
110
|
-
let rawLogs;
|
|
111
|
-
switch (job.type) {
|
|
112
|
-
case generated_1.WorkflowJobType.Build:
|
|
113
|
-
case generated_1.WorkflowJobType.Repack:
|
|
114
|
-
rawLogs = await (0, fetchLogs_1.fetchRawLogsForBuildJobAsync)(state, job);
|
|
115
|
-
break;
|
|
116
|
-
default:
|
|
117
|
-
rawLogs = await (0, fetchLogs_1.fetchRawLogsForCustomJobAsync)(job);
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
if (!rawLogs) {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
log_1.default.debug(`rawLogs = ${JSON.stringify(rawLogs, null, 2)}`);
|
|
124
|
-
const logs = new Map();
|
|
125
|
-
rawLogs.split('\n').forEach((line, index) => {
|
|
126
|
-
log_1.default.debug(`line ${index} = ${JSON.stringify(line, null, 2)}`);
|
|
127
|
-
try {
|
|
128
|
-
const parsedLine = JSON.parse(line);
|
|
129
|
-
const { buildStepDisplayName, buildStepId, phase, time, msg, result, marker, err } = parsedLine;
|
|
130
|
-
const stepKey = buildStepId ?? buildStepDisplayName ?? phase;
|
|
131
|
-
const stepLabel = buildStepDisplayName ?? buildStepId ?? phase;
|
|
132
|
-
if (stepKey && stepLabel) {
|
|
133
|
-
if (!logs.has(stepKey)) {
|
|
134
|
-
logs.set(stepKey, {
|
|
135
|
-
key: stepKey,
|
|
136
|
-
label: stepLabel,
|
|
137
|
-
logLines: [],
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
const logGroup = logs.get(stepKey);
|
|
141
|
-
if (buildStepDisplayName) {
|
|
142
|
-
logGroup.label = buildStepDisplayName;
|
|
143
|
-
}
|
|
144
|
-
logGroup.logLines.push({ time, msg, result, marker, err });
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
catch { }
|
|
148
|
-
});
|
|
149
|
-
return logs;
|
|
150
|
-
}
|
|
151
109
|
function descriptionForJobStatus(status) {
|
|
152
110
|
switch (status) {
|
|
153
111
|
case generated_1.WorkflowJobStatus.New:
|
|
@@ -168,73 +126,78 @@ function descriptionForJobStatus(status) {
|
|
|
168
126
|
return 'Pending cancel';
|
|
169
127
|
}
|
|
170
128
|
}
|
|
171
|
-
|
|
129
|
+
function isJobCompleted(status) {
|
|
130
|
+
switch (status) {
|
|
131
|
+
case generated_1.WorkflowJobStatus.Success:
|
|
132
|
+
case generated_1.WorkflowJobStatus.Failure:
|
|
133
|
+
case generated_1.WorkflowJobStatus.Canceled:
|
|
134
|
+
case generated_1.WorkflowJobStatus.Skipped:
|
|
135
|
+
return true;
|
|
136
|
+
case generated_1.WorkflowJobStatus.New:
|
|
137
|
+
case generated_1.WorkflowJobStatus.InProgress:
|
|
138
|
+
case generated_1.WorkflowJobStatus.ActionRequired:
|
|
139
|
+
case generated_1.WorkflowJobStatus.PendingCancel:
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function stepLogTail(step, maxLogLines // -1 means no limit
|
|
144
|
+
) {
|
|
145
|
+
const logLines = step.logLines ?? [];
|
|
146
|
+
const tail = maxLogLines === -1 ? logLines : logLines.slice(-maxLogLines);
|
|
147
|
+
return tail.map(line => line.msg);
|
|
148
|
+
}
|
|
149
|
+
async function logsForFailedWorkflowRunAsync(graphqlClient, workflowRun) {
|
|
150
|
+
const jobs = workflowRun.jobs.filter(job => job.status === generated_1.WorkflowJobStatus.Failure);
|
|
151
|
+
return await Promise.all(jobs.map(async (job) => {
|
|
152
|
+
const maybeLogs = await (0, parseLogs_1.fetchAndProcessLogsFromJobAsync)({ graphqlClient }, job);
|
|
153
|
+
return { job, logs: maybeLogs ?? new Map() };
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
function formatActiveWorkflowRun(jobLogs, maxLogLines = 5 // -1 means no limit
|
|
172
157
|
) {
|
|
173
|
-
const statusLines = [];
|
|
174
158
|
const statusValues = [];
|
|
175
|
-
for (const job of
|
|
159
|
+
for (const { job, logs } of jobLogs) {
|
|
176
160
|
statusValues.push({ label: '', value: '' });
|
|
177
161
|
statusValues.push({ label: ' Job', value: job.name });
|
|
178
162
|
statusValues.push({ label: ' Status', value: descriptionForJobStatus(job.status) });
|
|
179
163
|
if (job.status !== generated_1.WorkflowJobStatus.InProgress) {
|
|
180
164
|
continue;
|
|
181
165
|
}
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (maxLogLines === -1) {
|
|
193
|
-
return true;
|
|
194
|
-
}
|
|
195
|
-
return index > (currentStep.logLines?.length ?? 0) - maxLogLines;
|
|
196
|
-
}) ?? [];
|
|
197
|
-
for (const log of currentLogs) {
|
|
198
|
-
statusValues.push({ label: '', value: log });
|
|
199
|
-
}
|
|
166
|
+
const steps = choicesFromWorkflowLogs(logs);
|
|
167
|
+
if (steps.length === 0) {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const currentStep = steps[steps.length - 1];
|
|
171
|
+
statusValues.push({ label: ' Current step', value: currentStep.name });
|
|
172
|
+
if (currentStep.logLines?.length) {
|
|
173
|
+
statusValues.push({ label: ' Current logs', value: '' });
|
|
174
|
+
for (const log of stepLogTail(currentStep, maxLogLines)) {
|
|
175
|
+
statusValues.push({ label: '', value: log });
|
|
200
176
|
}
|
|
201
177
|
}
|
|
202
178
|
}
|
|
203
179
|
statusValues.push({ label: '', value: '' });
|
|
204
|
-
|
|
205
|
-
return statusLines.join('\n');
|
|
180
|
+
return (0, formatFields_1.default)(statusValues);
|
|
206
181
|
}
|
|
207
|
-
|
|
182
|
+
function formatFailedWorkflowRun(jobLogs, maxLogLines = -1 // -1 means no limit
|
|
208
183
|
) {
|
|
209
|
-
const statusLines = [];
|
|
210
184
|
const statusValues = [];
|
|
211
|
-
const
|
|
212
|
-
for (const job of workflowRun.jobs) {
|
|
213
|
-
if (job.status !== generated_1.WorkflowJobStatus.Failure) {
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
const logs = await fetchAndProcessLogsFromJobAsync({ graphqlClient }, job);
|
|
217
|
-
const steps = logs ? choicesFromWorkflowLogs(logs) : [];
|
|
185
|
+
for (const { job, logs } of jobLogs) {
|
|
218
186
|
statusValues.push({ label: '', value: '' });
|
|
219
187
|
statusValues.push({ label: ' Failed job', value: job.name });
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
for (const log of logs) {
|
|
230
|
-
statusValues.push({ label: '', value: log });
|
|
231
|
-
}
|
|
232
|
-
}
|
|
188
|
+
const steps = choicesFromWorkflowLogs(logs);
|
|
189
|
+
const failedStep = steps.find(step => step.status === 'fail' || step.status === 'failed');
|
|
190
|
+
if (!failedStep) {
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
statusValues.push({ label: ' Failed step', value: failedStep.name });
|
|
194
|
+
statusValues.push({ label: ' Logs for failed step', value: '' });
|
|
195
|
+
for (const log of stepLogTail(failedStep, maxLogLines)) {
|
|
196
|
+
statusValues.push({ label: '', value: log });
|
|
233
197
|
}
|
|
234
198
|
}
|
|
235
199
|
statusValues.push({ label: '', value: '' });
|
|
236
|
-
|
|
237
|
-
return statusLines.join('\n');
|
|
200
|
+
return (0, formatFields_1.default)(statusValues);
|
|
238
201
|
}
|
|
239
202
|
async function fileExistsAsync(filePath) {
|
|
240
203
|
return await fs.promises
|
|
@@ -271,57 +234,92 @@ async function showWorkflowStatusAsync(graphqlClient, { workflowRunId, spinnerUs
|
|
|
271
234
|
stream: spinnerUsesStdErr ? process.stderr : process.stdout,
|
|
272
235
|
text: '',
|
|
273
236
|
}).start();
|
|
274
|
-
|
|
237
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
238
|
+
prefixText: (0, chalk_1.default) `{bold.yellow Workflow run is waiting to start:}`,
|
|
239
|
+
});
|
|
240
|
+
const watcher = new watcher_1.WorkflowRunLogsWatcher(graphqlClient, () => (0, centrifuge_1.createRealtimeLogsClient)(graphqlClient), () => {
|
|
241
|
+
renderActiveWorkflowRun();
|
|
242
|
+
});
|
|
275
243
|
let failedFetchesCount = 0;
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
244
|
+
let renderActiveWorkflowRun = () => { };
|
|
245
|
+
try {
|
|
246
|
+
while (true) {
|
|
247
|
+
try {
|
|
248
|
+
const workflowRun = await WorkflowRunQuery_1.WorkflowRunQuery.withJobsByIdAsync(graphqlClient, workflowRunId, {
|
|
249
|
+
useCache: false,
|
|
250
|
+
});
|
|
251
|
+
failedFetchesCount = 0;
|
|
252
|
+
switch (workflowRun.status) {
|
|
253
|
+
case generated_1.WorkflowRunStatus.New:
|
|
254
|
+
break;
|
|
255
|
+
case generated_1.WorkflowRunStatus.InProgress: {
|
|
256
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
257
|
+
prefixText: (0, chalk_1.default) `{bold.green Workflow run is in progress:}`,
|
|
258
|
+
});
|
|
259
|
+
const logsStates = await watcher.syncJobsAsync(workflowRun.jobs);
|
|
260
|
+
for (const job of workflowRun.jobs) {
|
|
261
|
+
if (isJobCompleted(job.status)) {
|
|
262
|
+
(0, nullthrows_1.default)(logsStates.get(job.id), 'syncJobsAsync must have been called before markCompleted').markCompleted();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
renderActiveWorkflowRun = () => {
|
|
266
|
+
const text = formatActiveWorkflowRun(workflowRun.jobs.map(job => ({
|
|
267
|
+
job,
|
|
268
|
+
logs: (0, nullthrows_1.default)(logsStates.get(job.id), 'syncJobsAsync must have been called before getLogs').getLogs(),
|
|
269
|
+
})));
|
|
270
|
+
(0, ora_1.updateSpinnerText)(spinner, { text });
|
|
271
|
+
};
|
|
272
|
+
renderActiveWorkflowRun();
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
case generated_1.WorkflowRunStatus.ActionRequired:
|
|
276
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
277
|
+
prefixText: (0, chalk_1.default) `{bold.yellow Workflow run is waiting for action:}`,
|
|
278
|
+
});
|
|
279
|
+
break;
|
|
280
|
+
case generated_1.WorkflowRunStatus.Canceled:
|
|
281
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
282
|
+
prefixText: (0, chalk_1.default) `{bold.yellow Workflow has been canceled.}`,
|
|
283
|
+
});
|
|
284
|
+
spinner.stopAndPersist();
|
|
285
|
+
return workflowRun;
|
|
286
|
+
case generated_1.WorkflowRunStatus.Failure: {
|
|
287
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
288
|
+
prefixText: (0, chalk_1.default) `{bold.red Workflow has failed.}`,
|
|
289
|
+
});
|
|
290
|
+
const jobLogs = await logsForFailedWorkflowRunAsync(graphqlClient, workflowRun);
|
|
291
|
+
spinner.fail(formatFailedWorkflowRun(jobLogs, 30));
|
|
292
|
+
return workflowRun;
|
|
293
|
+
}
|
|
294
|
+
case generated_1.WorkflowRunStatus.Success:
|
|
295
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
296
|
+
prefixText: (0, chalk_1.default) `{bold.green Workflow has completed successfully.}`,
|
|
297
|
+
});
|
|
298
|
+
spinner.succeed('');
|
|
299
|
+
return workflowRun;
|
|
289
300
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
spinner.prefixText = (0, chalk_1.default) `{bold.yellow Workflow has been canceled.}`;
|
|
295
|
-
spinner.stopAndPersist();
|
|
296
|
-
return workflowRun;
|
|
297
|
-
case generated_1.WorkflowRunStatus.Failure: {
|
|
298
|
-
spinner.prefixText = (0, chalk_1.default) `{bold.red Workflow has failed.}`;
|
|
299
|
-
const failedInfo = await infoForFailedWorkflowRunAsync(graphqlClient, workflowRun, 30);
|
|
300
|
-
spinner.fail(failedInfo);
|
|
301
|
+
if (!waitForCompletion) {
|
|
302
|
+
if (spinner.isSpinning) {
|
|
303
|
+
spinner.stopAndPersist();
|
|
304
|
+
}
|
|
301
305
|
return workflowRun;
|
|
302
306
|
}
|
|
303
|
-
case generated_1.WorkflowRunStatus.Success:
|
|
304
|
-
spinner.prefixText = (0, chalk_1.default) `{bold.green Workflow has completed successfully.}`;
|
|
305
|
-
spinner.text = '';
|
|
306
|
-
spinner.succeed('');
|
|
307
|
-
return workflowRun;
|
|
308
307
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
catch {
|
|
309
|
+
(0, ora_1.updateSpinnerText)(spinner, {
|
|
310
|
+
text: '⚠ Failed to fetch the workflow run status. Check your network connection.',
|
|
311
|
+
});
|
|
312
|
+
failedFetchesCount += 1;
|
|
313
|
+
if (failedFetchesCount > 6) {
|
|
314
|
+
spinner.fail('Failed to fetch the workflow run status 6 times in a row. Aborting wait.');
|
|
315
|
+
process.exit(exports.workflowRunExitCodes.WAIT_ABORTED);
|
|
312
316
|
}
|
|
313
|
-
return workflowRun;
|
|
314
317
|
}
|
|
318
|
+
await (0, promise_1.sleepAsync)(10 /* seconds */ * 1000 /* milliseconds */);
|
|
315
319
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
if (failedFetchesCount > 6) {
|
|
320
|
-
spinner.fail('Failed to fetch the workflow run status 6 times in a row. Aborting wait.');
|
|
321
|
-
process.exit(exports.workflowRunExitCodes.WAIT_ABORTED);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
await (0, promise_1.sleepAsync)(10 /* seconds */ * 1000 /* milliseconds */);
|
|
320
|
+
}
|
|
321
|
+
finally {
|
|
322
|
+
watcher.close();
|
|
325
323
|
}
|
|
326
324
|
}
|
|
327
325
|
exports.workflowRunExitCodes = {
|
|
@@ -57,6 +57,7 @@ class SimulatorGet extends EasCommand_1.default {
|
|
|
57
57
|
(0, json_1.printJsonOnlyOutput)({
|
|
58
58
|
id: session.id,
|
|
59
59
|
name: session.name ?? undefined,
|
|
60
|
+
tags: session.tags,
|
|
60
61
|
type: (0, utils_1.deviceRunSessionTypeToFlagValue)(session.type),
|
|
61
62
|
status: session.status,
|
|
62
63
|
platform: session.platform,
|
|
@@ -89,6 +90,7 @@ function formatSessionFields(session, deviceRunSessionUrl) {
|
|
|
89
90
|
return (0, formatFields_1.default)([
|
|
90
91
|
{ label: 'ID', value: session.id },
|
|
91
92
|
{ label: 'Name', value: formatNullable(session.name) },
|
|
93
|
+
{ label: 'Tags', value: session.tags.length > 0 ? session.tags.join(', ') : 'none' },
|
|
92
94
|
{ label: 'Type', value: session.type },
|
|
93
95
|
{ label: 'Status', value: session.status },
|
|
94
96
|
{ label: 'Platform', value: session.platform },
|
|
@@ -8,6 +8,7 @@ export default class Simulator extends EasCommand {
|
|
|
8
8
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
9
|
platform: import("@oclif/core/lib/interfaces").OptionFlag<"android" | "ios" | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
10
|
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
tag: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
12
|
device: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
13
|
'build-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
14
|
'application-archive-url': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
@@ -43,6 +43,10 @@ class Simulator extends EasCommand_1.default {
|
|
|
43
43
|
name: core_1.Flags.string({
|
|
44
44
|
description: 'Human-readable name for the simulator session, shown in eas simulator:list and on expo.dev. Defaults to unnamed.',
|
|
45
45
|
}),
|
|
46
|
+
tag: core_1.Flags.string({
|
|
47
|
+
description: 'Label used to group simulator sessions, for example one per app variant. Repeat for multiple tags. Stored lowercased.',
|
|
48
|
+
multiple: true,
|
|
49
|
+
}),
|
|
46
50
|
device: core_1.Flags.string({
|
|
47
51
|
description: 'Virtual device to start for the session. On iOS, a Simulator device name or UDID (e.g. "iPhone 16 Pro"). On Android, an AVD hardware profile id (e.g. "pixel_7"). Defaults to a device chosen by the runner.',
|
|
48
52
|
}),
|
|
@@ -127,6 +131,7 @@ class Simulator extends EasCommand_1.default {
|
|
|
127
131
|
// The server rejects blank names, so trim here and treat a whitespace-only
|
|
128
132
|
// --name as if it had been omitted rather than surfacing a validation error.
|
|
129
133
|
const name = flags.name?.trim() || undefined;
|
|
134
|
+
const tags = flags.tag?.map(tag => tag.trim()).filter(tag => tag.length > 0);
|
|
130
135
|
const deviceIdentifier = flags.device?.trim() || undefined;
|
|
131
136
|
const buildId = flags['build-id']?.trim() || undefined;
|
|
132
137
|
const applicationArchiveUrlFromFlag = flags['application-archive-url']?.trim() || undefined;
|
|
@@ -151,6 +156,10 @@ class Simulator extends EasCommand_1.default {
|
|
|
151
156
|
throw new Error(`Existing simulator session in environment. Use --force to create a new simulator session.`);
|
|
152
157
|
}
|
|
153
158
|
const platform = await resolvePlatformAsync(flags.platform, nonInteractive);
|
|
159
|
+
if (platform === generated_1.AppPlatform.Android) {
|
|
160
|
+
log_1.default.warn('Android emulator support in EAS Simulator is still in development. Some features available on iOS may not work on Android yet. Full parity with iOS is coming soon.');
|
|
161
|
+
log_1.default.newLine();
|
|
162
|
+
}
|
|
154
163
|
const expoGoSdkVersion = flags['expo-go']
|
|
155
164
|
? await (0, expoGo_1.resolveExpoGoSdkVersionAsync)({ projectDir, sdkVersion: sdkVersionFromFlag })
|
|
156
165
|
: undefined;
|
|
@@ -168,6 +177,7 @@ class Simulator extends EasCommand_1.default {
|
|
|
168
177
|
const session = await DeviceRunSessionMutation_1.DeviceRunSessionMutation.createDeviceRunSessionAsync(graphqlClient, {
|
|
169
178
|
appId: projectId,
|
|
170
179
|
name,
|
|
180
|
+
...(tags?.length ? { tags } : {}),
|
|
171
181
|
platform,
|
|
172
182
|
type: utils_1.DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE[flags.type],
|
|
173
183
|
packageVersion: flags['package-version'],
|
|
@@ -10,6 +10,7 @@ export default class SimulatorList extends EasCommand {
|
|
|
10
10
|
type: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
11
|
platform: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
12
|
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
tag: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
14
|
limit: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
|
|
14
15
|
after: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
16
|
};
|
|
@@ -54,6 +54,10 @@ class SimulatorList extends EasCommand_1.default {
|
|
|
54
54
|
name: core_1.Flags.string({
|
|
55
55
|
description: 'Filter by session name (case-insensitive prefix match)',
|
|
56
56
|
}),
|
|
57
|
+
tag: core_1.Flags.string({
|
|
58
|
+
description: 'Filter by tag (repeatable). A session must carry every tag listed.',
|
|
59
|
+
multiple: true,
|
|
60
|
+
}),
|
|
57
61
|
limit: (0, pagination_1.getLimitFlagWithCustomValues)({ defaultTo: DEFAULT_LIMIT, limit: MAX_LIMIT }),
|
|
58
62
|
after: core_1.Flags.string({
|
|
59
63
|
description: 'Cursor for pagination. Use the endCursor from a previous query to fetch the next page.',
|
|
@@ -86,6 +90,9 @@ class SimulatorList extends EasCommand_1.default {
|
|
|
86
90
|
if (flags.name) {
|
|
87
91
|
filter.name = flags.name;
|
|
88
92
|
}
|
|
93
|
+
if (flags.tag && flags.tag.length > 0) {
|
|
94
|
+
filter.tags = flags.tag;
|
|
95
|
+
}
|
|
89
96
|
const limit = flags.limit ?? DEFAULT_LIMIT;
|
|
90
97
|
const fetchSpinner = jsonFlag ? null : (0, ora_1.ora)('Fetching simulator sessions').start();
|
|
91
98
|
let connection;
|
|
@@ -108,6 +115,7 @@ class SimulatorList extends EasCommand_1.default {
|
|
|
108
115
|
sessions: sessions.map(session => ({
|
|
109
116
|
id: session.id,
|
|
110
117
|
name: session.name ?? undefined,
|
|
118
|
+
tags: session.tags,
|
|
111
119
|
type: (0, utils_1.deviceRunSessionTypeToFlagValue)(session.type),
|
|
112
120
|
status: session.status,
|
|
113
121
|
platform: session.platform,
|
|
@@ -131,6 +139,7 @@ class SimulatorList extends EasCommand_1.default {
|
|
|
131
139
|
const lines = [
|
|
132
140
|
`ID: ${session.id}`,
|
|
133
141
|
`Name: ${session.name ?? 'null'}`,
|
|
142
|
+
`Tags: ${session.tags.length > 0 ? session.tags.join(', ') : 'none'}`,
|
|
134
143
|
`Type: ${session.type}`,
|
|
135
144
|
`Status: ${session.status}`,
|
|
136
145
|
`Platform: ${session.platform}`,
|
|
@@ -40,6 +40,12 @@
|
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
42
|
import EasCommand from '../../commandUtils/EasCommand';
|
|
43
|
+
export declare function resolveWorkflowRunSshInput({ ssh, idleTimeoutSeconds, }: {
|
|
44
|
+
ssh: boolean;
|
|
45
|
+
idleTimeoutSeconds: number | undefined;
|
|
46
|
+
}): {
|
|
47
|
+
idleTimeoutSeconds: number | undefined;
|
|
48
|
+
} | null;
|
|
43
49
|
export default class WorkflowRun extends EasCommand {
|
|
44
50
|
static description: string;
|
|
45
51
|
static args: {
|
|
@@ -50,6 +56,8 @@ export default class WorkflowRun extends EasCommand {
|
|
|
50
56
|
wait: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
51
57
|
input: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
52
58
|
ref: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
59
|
+
ssh: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
60
|
+
'ssh-idle-timeout': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
53
61
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
54
62
|
};
|
|
55
63
|
static contextDefinition: {
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.resolveWorkflowRunSshInput = resolveWorkflowRunSshInput;
|
|
44
45
|
const tslib_1 = require("tslib");
|
|
45
46
|
const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
|
|
46
47
|
const core_1 = require("@oclif/core");
|
|
@@ -64,6 +65,12 @@ const uploadAccountScopedFileAsync_1 = require("../../project/uploadAccountScope
|
|
|
64
65
|
const uploadAccountScopedProjectSourceAsync_1 = require("../../project/uploadAccountScopedProjectSourceAsync");
|
|
65
66
|
const json_1 = require("../../utils/json");
|
|
66
67
|
const workflowFile_1 = require("../../utils/workflowFile");
|
|
68
|
+
function resolveWorkflowRunSshInput({ ssh, idleTimeoutSeconds, }) {
|
|
69
|
+
if (idleTimeoutSeconds !== undefined && !ssh) {
|
|
70
|
+
throw new Error('--ssh-idle-timeout requires --ssh.');
|
|
71
|
+
}
|
|
72
|
+
return ssh ? { idleTimeoutSeconds } : null;
|
|
73
|
+
}
|
|
67
74
|
class WorkflowRun extends EasCommand_1.default {
|
|
68
75
|
static description = 'run an EAS workflow. The entire local project directory will be packaged and uploaded to EAS servers for the workflow run, unless the --ref flag is used.';
|
|
69
76
|
static args = {
|
|
@@ -91,6 +98,17 @@ class WorkflowRun extends EasCommand_1.default {
|
|
|
91
98
|
description: "The git reference must exist in the project's git repository, and the workflow file must exist at that reference. When this flag is used, the local project is not uploaded; instead, the workflow is run from the exact state of the project at the chosen reference.",
|
|
92
99
|
summary: 'Git reference to run the workflow on',
|
|
93
100
|
}),
|
|
101
|
+
ssh: core_1.Flags.boolean({
|
|
102
|
+
default: false,
|
|
103
|
+
description: 'Open an SSH session on each VM job for live debugging with `eas workflow:ssh`.',
|
|
104
|
+
summary: '[EXPERIMENTAL] Enable SSH on the run',
|
|
105
|
+
}),
|
|
106
|
+
'ssh-idle-timeout': core_1.Flags.integer({
|
|
107
|
+
description: 'Seconds to keep an SSH session open after its job finishes, while no client is connected. The session is always available for the whole job. Requires --ssh. Must be between 0 and 3600; defaults to 0 (close as soon as the job finishes and nobody is connected).',
|
|
108
|
+
summary: '[EXPERIMENTAL] SSH idle timeout in seconds',
|
|
109
|
+
min: 0,
|
|
110
|
+
max: 3600,
|
|
111
|
+
}),
|
|
94
112
|
...flags_1.EasJsonOnlyFlag,
|
|
95
113
|
};
|
|
96
114
|
static contextDefinition = {
|
|
@@ -104,6 +122,10 @@ class WorkflowRun extends EasCommand_1.default {
|
|
|
104
122
|
if (flags.json) {
|
|
105
123
|
(0, json_1.enableJsonOutput)();
|
|
106
124
|
}
|
|
125
|
+
const sshInput = resolveWorkflowRunSshInput({
|
|
126
|
+
ssh: flags.ssh,
|
|
127
|
+
idleTimeoutSeconds: flags['ssh-idle-timeout'],
|
|
128
|
+
});
|
|
107
129
|
const { getDynamicPrivateProjectConfigAsync, loggedIn: { graphqlClient }, vcsClient, projectDir, } = await this.getContextAsync(WorkflowRun, {
|
|
108
130
|
nonInteractive: flags['non-interactive'],
|
|
109
131
|
withServerSideEnvironment: null,
|
|
@@ -216,6 +238,7 @@ class WorkflowRun extends EasCommand_1.default {
|
|
|
216
238
|
workflowRevisionId: workflowRevisionId ?? '',
|
|
217
239
|
gitRef,
|
|
218
240
|
inputs,
|
|
241
|
+
ssh: sshInput,
|
|
219
242
|
});
|
|
220
243
|
}
|
|
221
244
|
catch (err) {
|
|
@@ -274,6 +297,7 @@ class WorkflowRun extends EasCommand_1.default {
|
|
|
274
297
|
packageJsonBucketKey,
|
|
275
298
|
projectRootDirectory,
|
|
276
299
|
},
|
|
300
|
+
ssh: sshInput,
|
|
277
301
|
},
|
|
278
302
|
}));
|
|
279
303
|
}
|
|
@@ -284,6 +308,9 @@ class WorkflowRun extends EasCommand_1.default {
|
|
|
284
308
|
}
|
|
285
309
|
log_1.default.newLine();
|
|
286
310
|
log_1.default.log(`See logs: ${(0, log_1.link)((0, url_1.getWorkflowRunUrl)(account.name, projectName, workflowRunId))}`);
|
|
311
|
+
if (sshInput) {
|
|
312
|
+
log_1.default.log('SSH enabled. Each VM job logs the `eas workflow:ssh` command to connect.');
|
|
313
|
+
}
|
|
287
314
|
if (!flags.wait) {
|
|
288
315
|
if (flags.json) {
|
|
289
316
|
(0, json_1.printJsonOnlyOutput)({
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
import { WorkflowJobSshConnectInfo, WorkflowJobSshSession } from '../../graphql/queries/WorkflowJobSshQuery';
|
|
3
|
+
export declare function splitConnectionHost(connectionHost: string): {
|
|
4
|
+
hostname: string;
|
|
5
|
+
port?: number;
|
|
6
|
+
};
|
|
7
|
+
export type SshConnectStatus = 'unknown' | 'not-enabled' | 'ended' | 'pending' | 'ready';
|
|
8
|
+
export declare function resolveSshConnectStatus(connectInfo: (Pick<WorkflowJobSshConnectInfo, 'sshRequested' | 'jobCompleted'> & {
|
|
9
|
+
session?: Pick<WorkflowJobSshSession, 'connectionConfig'> | null;
|
|
10
|
+
}) | null): SshConnectStatus;
|
|
11
|
+
export declare function terminalSshStatusMessage(status: SshConnectStatus, resourceId: string): string | null;
|
|
12
|
+
export declare function sshHostAliasForResource(resourceId: string): string;
|
|
13
|
+
export declare function parseSshArgv(rawArgv: readonly string[]): {
|
|
14
|
+
showConnect: boolean;
|
|
15
|
+
resourceId: string | undefined;
|
|
16
|
+
command: string[];
|
|
17
|
+
};
|
|
18
|
+
export default class WorkflowSsh extends EasCommand {
|
|
19
|
+
static hidden: boolean;
|
|
20
|
+
static description: string;
|
|
21
|
+
static strict: boolean;
|
|
22
|
+
static flags: {
|
|
23
|
+
'show-connect': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
24
|
+
};
|
|
25
|
+
static contextDefinition: {
|
|
26
|
+
loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
|
|
27
|
+
};
|
|
28
|
+
private isRunningSubprocess;
|
|
29
|
+
runAsync(): Promise<void>;
|
|
30
|
+
protected catch(err: Error): Promise<void>;
|
|
31
|
+
}
|