@devries-cameron20 / composio Mirror · read-only / commits / d7993b2c4
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 17:15 UTC

refactor(cli): thread install image platform through e2e runs

jkomyno committed Aug 1, 2026 at 17:45 UTC d7993b2c46d78e7034c0994aeac49bab581315a5
3 files changed +20 -25
ts/e2e-tests/_utils/src/image-lifecycle.ts
+11 -22
@@ -728,8 +728,15 @@ export interface EnsureInstallImageOptions {
728 platform?: InstallPlatform;
729 }
730
731 +export interface InstallImage {
732 + imageTag: string;
733 + platform: InstallPlatform;
734 +}
735 +
736 export interface RunInstallContainerOptions {
737 imageTag: string;
738 + shell: InstallShell;
739 + platform: InstallPlatform;
740 cmd: string[];
741 env?: Record<string, string | undefined>;
742 labels?: Record<string, string>;
@@ -750,7 +757,7 @@ function defaultInstallLabels(shell: InstallShell): Record<string, string> {
757 export async function ensureInstallImage(
758 shell: InstallShell,
759 options: EnsureInstallImageOptions = {}
753 -): Promise<string> {
760 +): Promise<InstallImage> {
761 if (shell !== 'bash' && shell !== 'zsh') {
762 throw new Error(`ensureInstallImage(${shell}): shell must be bash or zsh`);
763 }
@@ -767,7 +774,7 @@ export async function ensureInstallImage(
774 { cwd: repoRoot }
775 );
776 if (inspect.exitCode === 0 && inspect.stdout.trim() === architecture) {
770 - return imageTag;
777 + return { imageTag, platform };
778 }
779
780 const built = await exec(
@@ -793,35 +800,17 @@ export async function ensureInstallImage(
800 throw err;
801 }
802
796 - return imageTag;
803 + return { imageTag, platform };
804 }
805
806 export async function runInstallContainer(
807 options: RunInstallContainerOptions
808 ): Promise<ExecResult> {
802 - const { imageTag, cmd, env, labels } = options;
803 - const shellMatch = /^composio-e2e-install:(bash|zsh)$/.exec(imageTag);
804 - if (!shellMatch) {
805 - throw new Error(
806 - 'runInstallContainer({ imageTag, ... }): expected composio-e2e-install:<bash|zsh>'
807 - );
808 - }
809 + const { imageTag, shell, platform, cmd, env, labels } = options;
810 if (!Array.isArray(cmd) || cmd.length === 0) {
811 throw new Error('runInstallContainer({ cmd, ... }): cmd must be a non-empty array');
812 }
813
813 - const shell = shellMatch[1] as InstallShell;
814 - const inspect = await exec('docker', [
815 - 'image',
816 - 'inspect',
817 - '--format',
818 - '{{.Architecture}}',
819 - imageTag,
820 - ]);
821 - if (inspect.exitCode !== 0) {
822 - throw new Error(`Failed to inspect Docker image ${imageTag}: ${inspect.stderr}`);
823 - }
824 - const platform = inspect.stdout.trim() === 'arm64' ? 'linux/arm64' : 'linux/amd64';
814 const dockerArgs = [
815 'run',
816 '--rm',
ts/e2e-tests/_utils/src/index.ts
+1
@@ -20,4 +20,5 @@ export {
20 ensureInstallImage,
21 runInstallContainer,
22 type ExecResult,
23 + type InstallImage,
24 } from './image-lifecycle';
ts/e2e-tests/cli/install/e2e.test.ts
+8 -3
@@ -6,6 +6,7 @@ import {
6 resolveInstallE2EConfig,
7 runInstallContainer,
8 type ExecResult,
9 + type InstallImage,
10 } from '@e2e-tests/utils';
11 import { INSTALL_E2E_LOCAL_RELEASE_TAG } from '@e2e-tests/utils/const';
12 import { startInstallReleaseServer, type InstallReleaseServer } from './release-server';
@@ -14,7 +15,7 @@ const config = resolveInstallE2EConfig();
15 const repoRoot = resolve(import.meta.dir, '../../../..');
16 const timeout = 600_000;
17
17 -let imageTag = '';
18 +let image: InstallImage | undefined;
19 let releaseServer: InstallReleaseServer | undefined;
20
21 function assertSuccess(result: ExecResult): void {
@@ -49,8 +50,12 @@ function installerEnvironment(): Record<string, string> {
50 }
51
52 async function run(script: string): Promise<ExecResult> {
53 + if (!image) {
54 + throw new Error('Install image is not ready');
55 + }
56 return runInstallContainer({
53 - imageTag,
57 + ...image,
58 + shell: config.shell,
59 cmd: [config.shell, '-lc', script],
60 env: installerEnvironment(),
61 });
@@ -68,7 +73,7 @@ beforeAll(async () => {
73 releaseDir: config.releaseDir!,
74 });
75 }
71 - imageTag = await ensureInstallImage(config.shell, {
76 + image = await ensureInstallImage(config.shell, {
77 repoRoot,
78 platform: releaseServer?.platform,
79 });