eas-cli 23.1.0 → 24.0.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 +424 -226
- package/build/api.d.ts +1 -0
- package/build/api.js +12 -0
- package/build/build/utils/url.d.ts +1 -0
- package/build/build/utils/url.js +4 -0
- package/build/channel/protection.d.ts +4 -0
- package/build/channel/protection.js +49 -0
- package/build/channel/queries.d.ts +6 -0
- package/build/channel/queries.js +5 -1
- 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/channel/protect.d.ts +16 -0
- package/build/commands/channel/protect.js +68 -0
- package/build/commands/channel/unprotect.d.ts +16 -0
- package/build/commands/channel/unprotect.js +78 -0
- package/build/commands/observe/errors.d.ts +27 -0
- package/build/commands/observe/errors.js +122 -0
- package/build/commands/observe/event.d.ts +18 -0
- package/build/commands/observe/event.js +149 -0
- package/build/commands/observe/events.d.ts +2 -0
- package/build/commands/observe/events.js +10 -4
- package/build/commands/observe/metrics-summary.d.ts +1 -0
- package/build/commands/observe/metrics-summary.js +3 -2
- package/build/commands/observe/metrics.d.ts +2 -0
- package/build/commands/observe/metrics.js +8 -4
- package/build/commands/observe/routes.d.ts +2 -1
- package/build/commands/observe/routes.js +5 -5
- package/build/commands/observe/session.d.ts +1 -0
- package/build/commands/observe/session.js +14 -8
- package/build/commands/observe/versions.d.ts +1 -0
- package/build/commands/observe/versions.js +3 -2
- package/build/commands/project/status.d.ts +16 -0
- package/build/commands/project/status.js +47 -0
- package/build/commands/simulator/get.js +5 -1
- package/build/commands/simulator/index.d.ts +1 -0
- package/build/commands/simulator/index.js +16 -2
- 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/credentials/ios/credentials.d.ts +5 -3
- package/build/credentials/ios/utils/printCredentials.js +6 -1
- package/build/graphql/generated.d.ts +2474 -1079
- package/build/graphql/generated.js +71 -16
- 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/AppStoreConnectApiKeyQuery.d.ts +1 -1
- package/build/graphql/queries/AppStoreConnectApiKeyQuery.js +1 -1
- package/build/graphql/queries/ChannelQuery.js +2 -0
- package/build/graphql/queries/DeviceRunSessionQuery.js +10 -0
- package/build/graphql/queries/ObserveQuery.d.ts +62 -30
- package/build/graphql/queries/ObserveQuery.js +276 -121
- package/build/graphql/queries/SubmissionQuery.d.ts +6 -1
- package/build/graphql/queries/SubmissionQuery.js +41 -0
- package/build/graphql/queries/WorkflowJobSshQuery.d.ts +20 -0
- package/build/graphql/queries/WorkflowJobSshQuery.js +133 -0
- package/build/graphql/types/Observe.d.ts +5 -3
- package/build/graphql/types/Observe.js +80 -21
- package/build/graphql/types/UpdateChannelBasicInfo.js +1 -0
- package/build/observe/fetchCustomEvents.d.ts +6 -4
- package/build/observe/fetchCustomEvents.js +4 -2
- package/build/observe/fetchErrors.d.ts +32 -0
- package/build/observe/fetchErrors.js +42 -0
- package/build/observe/fetchEvents.d.ts +9 -6
- package/build/observe/fetchEvents.js +16 -17
- package/build/observe/fetchMetrics.d.ts +2 -2
- package/build/observe/fetchMetrics.js +9 -9
- package/build/observe/fetchNavigationRoutes.d.ts +7 -5
- package/build/observe/fetchNavigationRoutes.js +8 -8
- package/build/observe/fetchSessions.d.ts +13 -11
- package/build/observe/fetchSessions.js +59 -30
- package/build/observe/fetchVersions.d.ts +4 -3
- package/build/observe/fetchVersions.js +7 -11
- package/build/observe/flags.d.ts +6 -0
- package/build/observe/flags.js +12 -2
- package/build/observe/formatCustomEvents.d.ts +16 -10
- package/build/observe/formatCustomEvents.js +61 -28
- package/build/observe/formatErrors.d.ts +97 -0
- package/build/observe/formatErrors.js +203 -0
- package/build/observe/formatEvents.d.ts +11 -5
- package/build/observe/formatEvents.js +46 -18
- package/build/observe/formatMetrics.d.ts +4 -4
- package/build/observe/formatMetrics.js +2 -2
- package/build/observe/formatNavigationRoutes.d.ts +4 -4
- package/build/observe/formatNavigationRoutes.js +3 -3
- package/build/observe/formatSessions.d.ts +3 -3
- package/build/observe/formatSessions.js +8 -8
- package/build/observe/formatVersions.js +2 -2
- package/build/observe/platforms.d.ts +10 -19
- package/build/observe/platforms.js +42 -40
- package/build/ora.d.ts +7 -0
- package/build/ora.js +12 -0
- package/build/project/projectStatus.d.ts +96 -0
- package/build/project/projectStatus.js +314 -0
- package/build/simulator/utils.d.ts +11 -0
- package/build/simulator/utils.js +51 -4
- package/build/submit/utils/urls.js +2 -3
- 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 +2947 -2328
- package/package.json +10 -7
- package/build/chat/chatClient.d.ts +0 -37
- package/build/chat/chatClient.js +0 -359
- package/build/chat/detectProject.d.ts +0 -5
- package/build/chat/detectProject.js +0 -41
- package/build/chat/renderMarkdown.d.ts +0 -7
- package/build/chat/renderMarkdown.js +0 -47
- package/build/chat/replInput.d.ts +0 -10
- package/build/chat/replInput.js +0 -52
- package/build/commandUtils/workflow/fetchLogs.d.ts +0 -6
- package/build/commandUtils/workflow/fetchLogs.js +0 -44
- package/build/commands/chat.d.ts +0 -18
- package/build/commands/chat.js +0 -221
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
5
|
+
const flags_1 = require("../../commandUtils/flags");
|
|
6
|
+
const pagination_1 = require("../../commandUtils/pagination");
|
|
7
|
+
const projectStatus_1 = require("../../project/projectStatus");
|
|
8
|
+
const json_1 = require("../../utils/json");
|
|
9
|
+
class ProjectStatus extends EasCommand_1.default {
|
|
10
|
+
static description = 'show a snapshot of the project: recent builds, dev builds, workflow runs, submissions, and updates';
|
|
11
|
+
static aliases = ['status'];
|
|
12
|
+
static examples = [
|
|
13
|
+
'$ eas status \t # Show a concise project snapshot',
|
|
14
|
+
'$ eas status --json \t # Output a machine-readable snapshot for agents and automation',
|
|
15
|
+
'$ eas status --json --limit 10 \t # Include more activity from each section',
|
|
16
|
+
];
|
|
17
|
+
static flags = {
|
|
18
|
+
limit: (0, pagination_1.getLimitFlagWithCustomValues)({
|
|
19
|
+
defaultTo: projectStatus_1.PROJECT_STATUS_DEFAULT_LIMIT,
|
|
20
|
+
limit: 25,
|
|
21
|
+
description: `The number of items to show in each section. Defaults to ${projectStatus_1.PROJECT_STATUS_DEFAULT_LIMIT} and is capped at 25.`,
|
|
22
|
+
}),
|
|
23
|
+
...flags_1.EasNonInteractiveAndJsonFlags,
|
|
24
|
+
};
|
|
25
|
+
static contextDefinition = {
|
|
26
|
+
...this.ContextOptions.ProjectId,
|
|
27
|
+
...this.ContextOptions.LoggedIn,
|
|
28
|
+
};
|
|
29
|
+
async runAsync() {
|
|
30
|
+
const { flags } = await this.parse(ProjectStatus);
|
|
31
|
+
const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
|
|
32
|
+
if (jsonFlag) {
|
|
33
|
+
(0, json_1.enableJsonOutput)();
|
|
34
|
+
}
|
|
35
|
+
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(ProjectStatus, { nonInteractive });
|
|
36
|
+
const status = await (0, projectStatus_1.getProjectStatusAsync)(graphqlClient, {
|
|
37
|
+
projectId,
|
|
38
|
+
limit: flags.limit ?? projectStatus_1.PROJECT_STATUS_DEFAULT_LIMIT,
|
|
39
|
+
});
|
|
40
|
+
if (jsonFlag) {
|
|
41
|
+
(0, json_1.printJsonOnlyOutput)(status);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
(0, projectStatus_1.printProjectStatusAsText)(status);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.default = ProjectStatus;
|
|
@@ -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,
|
|
@@ -65,7 +66,9 @@ class SimulatorGet extends EasCommand_1.default {
|
|
|
65
66
|
finishedAt: session.finishedAt ?? undefined,
|
|
66
67
|
updatedAt: session.updatedAt,
|
|
67
68
|
deviceRunSessionUrl,
|
|
68
|
-
remoteConfig: session.remoteConfig
|
|
69
|
+
remoteConfig: session.remoteConfig
|
|
70
|
+
? (0, utils_1.sanitizeRemoteConfigForJson)(session.remoteConfig)
|
|
71
|
+
: session.remoteConfig,
|
|
69
72
|
artifacts: session.artifacts,
|
|
70
73
|
});
|
|
71
74
|
return;
|
|
@@ -89,6 +92,7 @@ function formatSessionFields(session, deviceRunSessionUrl) {
|
|
|
89
92
|
return (0, formatFields_1.default)([
|
|
90
93
|
{ label: 'ID', value: session.id },
|
|
91
94
|
{ label: 'Name', value: formatNullable(session.name) },
|
|
95
|
+
{ label: 'Tags', value: session.tags.length > 0 ? session.tags.join(', ') : 'none' },
|
|
92
96
|
{ label: 'Type', value: session.type },
|
|
93
97
|
{ label: 'Status', value: session.status },
|
|
94
98
|
{ 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,10 +177,15 @@ 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'],
|
|
174
|
-
deviceIdentifier
|
|
184
|
+
...(deviceIdentifier
|
|
185
|
+
? platform === generated_1.AppPlatform.Ios
|
|
186
|
+
? { ios: { deviceIdentifier } }
|
|
187
|
+
: { android: { deviceIdentifier } }
|
|
188
|
+
: {}),
|
|
175
189
|
...(buildId ? { buildId } : {}),
|
|
176
190
|
...(applicationArchiveUrlFromFlag
|
|
177
191
|
? { applicationArchiveUrl: applicationArchiveUrlFromFlag }
|
|
@@ -274,7 +288,7 @@ class Simulator extends EasCommand_1.default {
|
|
|
274
288
|
name,
|
|
275
289
|
type: flags.type,
|
|
276
290
|
deviceRunSessionUrl,
|
|
277
|
-
remoteConfig,
|
|
291
|
+
remoteConfig: (0, utils_1.sanitizeRemoteConfigForJson)(remoteConfig),
|
|
278
292
|
});
|
|
279
293
|
return;
|
|
280
294
|
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.splitConnectionHost = splitConnectionHost;
|
|
4
|
+
exports.resolveSshConnectStatus = resolveSshConnectStatus;
|
|
5
|
+
exports.terminalSshStatusMessage = terminalSshStatusMessage;
|
|
6
|
+
exports.sshHostAliasForResource = sshHostAliasForResource;
|
|
7
|
+
exports.parseSshArgv = parseSshArgv;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
|
|
10
|
+
const core_1 = require("@oclif/core");
|
|
11
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
12
|
+
const node_os_1 = tslib_1.__importDefault(require("node:os"));
|
|
13
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
14
|
+
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
|
|
15
|
+
const WorkflowJobSshQuery_1 = require("../../graphql/queries/WorkflowJobSshQuery");
|
|
16
|
+
const log_1 = tslib_1.__importDefault(require("../../log"));
|
|
17
|
+
const ora_1 = require("../../ora");
|
|
18
|
+
const promise_1 = require("../../utils/promise");
|
|
19
|
+
function splitConnectionHost(connectionHost) {
|
|
20
|
+
try {
|
|
21
|
+
const { hostname, port: stringPort } = new URL(`ssh://${connectionHost}`);
|
|
22
|
+
const port = stringPort === '' ? undefined : Number(stringPort);
|
|
23
|
+
return { hostname, port };
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
throw new Error('Unexpected connection host reported for this ssh session. Update eas-cli and try again, or contact support if it persists.', { cause: err });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const SSH_INSECURE_OPTS = '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null';
|
|
30
|
+
const SESSION_OPEN_TIMEOUT_MS = 5 * 60 * 1000;
|
|
31
|
+
const SESSION_OPEN_POLL_INTERVAL_MS = 3000;
|
|
32
|
+
function resolveSshConnectStatus(connectInfo) {
|
|
33
|
+
if (!connectInfo) {
|
|
34
|
+
return 'unknown';
|
|
35
|
+
}
|
|
36
|
+
const { sshRequested, jobCompleted, session } = connectInfo;
|
|
37
|
+
if (session?.connectionConfig && !session.connectionConfig.reconnecting) {
|
|
38
|
+
return 'ready';
|
|
39
|
+
}
|
|
40
|
+
if (session?.connectionConfig?.reconnecting) {
|
|
41
|
+
return 'pending';
|
|
42
|
+
}
|
|
43
|
+
if (!sshRequested) {
|
|
44
|
+
return 'not-enabled';
|
|
45
|
+
}
|
|
46
|
+
return jobCompleted ? 'ended' : 'pending';
|
|
47
|
+
}
|
|
48
|
+
function terminalSshStatusMessage(status, resourceId) {
|
|
49
|
+
switch (status) {
|
|
50
|
+
case 'unknown':
|
|
51
|
+
return `No workflow job found for "${resourceId}". Pass a workflow job id from a run started with \`eas workflow:run --ssh\`.`;
|
|
52
|
+
case 'not-enabled':
|
|
53
|
+
return `SSH was not enabled for "${resourceId}". Start the run with \`eas workflow:run --ssh\` to enable it.`;
|
|
54
|
+
case 'ended':
|
|
55
|
+
return 'This ssh session has ended.';
|
|
56
|
+
case 'pending':
|
|
57
|
+
case 'ready':
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function sshHostAliasForResource(resourceId) {
|
|
62
|
+
const suffix = resourceId.replace(/[^A-Za-z0-9]/g, '').slice(0, 8);
|
|
63
|
+
return suffix ? `eas-workflow-ssh-${suffix}` : 'eas-workflow-ssh';
|
|
64
|
+
}
|
|
65
|
+
function parseSshArgv(rawArgv) {
|
|
66
|
+
let showConnect = false;
|
|
67
|
+
let index = 0;
|
|
68
|
+
while (index < rawArgv.length && rawArgv[index].startsWith('-')) {
|
|
69
|
+
if (rawArgv[index] === '--show-connect' || rawArgv[index] === '--show-connect=true') {
|
|
70
|
+
showConnect = true;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
throw new Error(`Unknown flag "${rawArgv[index]}" before the id. The only supported flag is --show-connect; everything after the id is passed to the remote shell.`);
|
|
74
|
+
}
|
|
75
|
+
index += 1;
|
|
76
|
+
}
|
|
77
|
+
const [resourceId, ...command] = rawArgv.slice(index);
|
|
78
|
+
return { showConnect, resourceId, command };
|
|
79
|
+
}
|
|
80
|
+
class WorkflowSsh extends EasCommand_1.default {
|
|
81
|
+
static hidden = true;
|
|
82
|
+
static description = '[EXPERIMENTAL] open an ssh session on the worker running a workflow job';
|
|
83
|
+
static strict = false;
|
|
84
|
+
static flags = {
|
|
85
|
+
'show-connect': core_1.Flags.boolean({
|
|
86
|
+
description: 'Print the ssh connection command (host and token) instead of opening a session',
|
|
87
|
+
default: false,
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
static contextDefinition = {
|
|
91
|
+
...this.ContextOptions.LoggedIn,
|
|
92
|
+
};
|
|
93
|
+
isRunningSubprocess = false;
|
|
94
|
+
async runAsync() {
|
|
95
|
+
const rawArgv = [...this.argv];
|
|
96
|
+
await this.parse(WorkflowSsh, []);
|
|
97
|
+
const { showConnect, resourceId, command } = parseSshArgv(rawArgv);
|
|
98
|
+
if (typeof resourceId !== 'string' || resourceId.length === 0) {
|
|
99
|
+
throw new Error('Provide a workflow job id: eas workflow:ssh <workflow-job-id> [command...]');
|
|
100
|
+
}
|
|
101
|
+
const { loggedIn: { graphqlClient }, } = await this.getContextAsync(WorkflowSsh, { nonInteractive: true });
|
|
102
|
+
const connectInfo = await WorkflowJobSshQuery_1.WorkflowJobSshQuery.connectInfoForResourceIdAsync(graphqlClient, resourceId);
|
|
103
|
+
const status = resolveSshConnectStatus(connectInfo);
|
|
104
|
+
const statusMessage = terminalSshStatusMessage(status, resourceId);
|
|
105
|
+
if (statusMessage) {
|
|
106
|
+
log_1.default.error(statusMessage);
|
|
107
|
+
process.exitCode = 1;
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const connectionConfig = (status === 'ready' ? connectInfo?.session?.connectionConfig : null) ??
|
|
111
|
+
(await waitForSessionToOpenAsync(graphqlClient, resourceId));
|
|
112
|
+
if (!connectionConfig) {
|
|
113
|
+
process.exitCode = 1;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const { host: connectionHost, secret } = connectionConfig;
|
|
117
|
+
const { hostname, port } = splitConnectionHost(connectionHost);
|
|
118
|
+
const portOption = port !== undefined ? ` -p ${port}` : '';
|
|
119
|
+
if (showConnect) {
|
|
120
|
+
log_1.default.log(`ssh ${SSH_INSECURE_OPTS}${portOption} ${secret}@${hostname}`);
|
|
121
|
+
log_1.default.newLine();
|
|
122
|
+
log_1.default.log('If your network blocks the direct SSH connection, reach the session through the WebSocket relay with upterm (https://upterm.dev):');
|
|
123
|
+
// WSS terminates on the relay hostname (default 443). Do not paste an SSH
|
|
124
|
+
// :port into the wss:// URL — that port is only for the ssh destination.
|
|
125
|
+
log_1.default.log(` ssh -o ProxyCommand="upterm proxy wss://${secret}@${hostname}" ${SSH_INSECURE_OPTS}${portOption} ${secret}@${hostname}`);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const configDir = await node_fs_1.default.promises.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), 'eas-workflow-ssh-'));
|
|
129
|
+
try {
|
|
130
|
+
const configPath = node_path_1.default.join(configDir, 'config');
|
|
131
|
+
const hostAlias = sshHostAliasForResource(resourceId);
|
|
132
|
+
await node_fs_1.default.promises.writeFile(configPath, [
|
|
133
|
+
`Host ${hostAlias}`,
|
|
134
|
+
` HostName ${hostname}`,
|
|
135
|
+
...(port !== undefined ? [` Port ${port}`] : []),
|
|
136
|
+
` User ${secret}`,
|
|
137
|
+
' StrictHostKeyChecking no',
|
|
138
|
+
' UserKnownHostsFile /dev/null',
|
|
139
|
+
'',
|
|
140
|
+
].join('\n'), { mode: 0o600 });
|
|
141
|
+
this.isRunningSubprocess = true;
|
|
142
|
+
await (0, spawn_async_1.default)('ssh', ['-F', configPath, hostAlias, ...command], {
|
|
143
|
+
stdio: 'inherit',
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
finally {
|
|
147
|
+
await node_fs_1.default.promises.rm(configDir, { recursive: true, force: true });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch(err) {
|
|
151
|
+
if (this.isRunningSubprocess) {
|
|
152
|
+
if (err.code === 'ENOENT') {
|
|
153
|
+
log_1.default.error('Could not run `ssh`. Install an OpenSSH client and make sure `ssh` is on your PATH, then try again.');
|
|
154
|
+
process.exitCode = 1;
|
|
155
|
+
return Promise.resolve();
|
|
156
|
+
}
|
|
157
|
+
const status = err.status;
|
|
158
|
+
process.exitCode = process.exitCode ?? status ?? 1;
|
|
159
|
+
return Promise.resolve();
|
|
160
|
+
}
|
|
161
|
+
return super.catch(err);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.default = WorkflowSsh;
|
|
165
|
+
async function waitForSessionToOpenAsync(graphqlClient, workflowJobId) {
|
|
166
|
+
const spinner = (0, ora_1.ora)('Waiting for the worker to open the ssh session').start();
|
|
167
|
+
const deadline = Date.now() + SESSION_OPEN_TIMEOUT_MS;
|
|
168
|
+
try {
|
|
169
|
+
while (Date.now() < deadline) {
|
|
170
|
+
const connectInfo = await WorkflowJobSshQuery_1.WorkflowJobSshQuery.connectInfoForResourceIdAsync(graphqlClient, workflowJobId);
|
|
171
|
+
const status = resolveSshConnectStatus(connectInfo);
|
|
172
|
+
const statusMessage = terminalSshStatusMessage(status, workflowJobId);
|
|
173
|
+
if (statusMessage) {
|
|
174
|
+
spinner.fail(statusMessage);
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
if (status === 'ready') {
|
|
178
|
+
spinner.succeed('The ssh session is ready.');
|
|
179
|
+
return connectInfo?.session?.connectionConfig ?? null;
|
|
180
|
+
}
|
|
181
|
+
await (0, promise_1.sleepAsync)(SESSION_OPEN_POLL_INTERVAL_MS);
|
|
182
|
+
}
|
|
183
|
+
spinner.fail('Timed out waiting for the ssh session to open. The worker may still be starting up; try again in a moment.');
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
spinner.stop();
|
|
188
|
+
throw err;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -40,7 +40,7 @@ export declare const distributionCertificateSchema: CredentialSchema<Distributio
|
|
|
40
40
|
export type MinimalAscApiKey = {
|
|
41
41
|
keyP8: string;
|
|
42
42
|
keyId: string;
|
|
43
|
-
issuerId
|
|
43
|
+
issuerId?: string;
|
|
44
44
|
teamId?: string;
|
|
45
45
|
teamName?: string;
|
|
46
46
|
roles?: UserRole[];
|
|
@@ -49,9 +49,11 @@ export type MinimalAscApiKey = {
|
|
|
49
49
|
export interface AscApiKeyPath {
|
|
50
50
|
keyP8Path: string;
|
|
51
51
|
keyId: string;
|
|
52
|
-
issuerId
|
|
52
|
+
issuerId?: string;
|
|
53
53
|
}
|
|
54
54
|
export declare const ascApiKeyIdSchema: CredentialSchema<Pick<MinimalAscApiKey, 'keyId'>>;
|
|
55
|
-
export declare const ascApiKeyIssuerIdSchema: CredentialSchema<
|
|
55
|
+
export declare const ascApiKeyIssuerIdSchema: CredentialSchema<{
|
|
56
|
+
issuerId: string;
|
|
57
|
+
}>;
|
|
56
58
|
export declare const pushKeySchema: CredentialSchema<PushKey>;
|
|
57
59
|
export declare const provisioningProfileSchema: CredentialSchema<ProvisioningProfile>;
|
|
@@ -204,7 +204,12 @@ function displayAscApiKey(maybeAscApiKey, fields) {
|
|
|
204
204
|
if (name) {
|
|
205
205
|
fields.push({ label: 'Name', value: name });
|
|
206
206
|
}
|
|
207
|
-
|
|
207
|
+
if (issuerIdentifier) {
|
|
208
|
+
fields.push({ label: 'Issuer ID', value: issuerIdentifier });
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
fields.push({ label: 'Key Type', value: 'Individual (submissions only)' });
|
|
212
|
+
}
|
|
208
213
|
if (roles) {
|
|
209
214
|
fields.push({ label: 'Roles', value: roles.join(',') });
|
|
210
215
|
}
|