Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
refactor(cli): thread install image platform through e2e runs
jkomynod7993b2c46d7
diff --git a/ts/e2e-tests/_utils/src/image-lifecycle.ts b/ts/e2e-tests/_utils/src/image-lifecycle.tsindex 4cb0239e6..f6afdad10 100644--- a/ts/e2e-tests/_utils/src/image-lifecycle.ts+++ b/ts/e2e-tests/_utils/src/image-lifecycle.ts@@ -728,8 +728,15 @@ export interface EnsureInstallImageOptions {platform?: InstallPlatform;}+export interface InstallImage {+ imageTag: string;+ platform: InstallPlatform;+}+export interface RunInstallContainerOptions {imageTag: string;+ shell: InstallShell;+ platform: InstallPlatform;cmd: string[];env?: Record<string, string | undefined>;labels?: Record<string, string>;@@ -750,7 +757,7 @@ function defaultInstallLabels(shell: InstallShell): Record<string, string> {export async function ensureInstallImage(shell: InstallShell,options: EnsureInstallImageOptions = {}-): Promise<string> {+): Promise<InstallImage> {if (shell !== 'bash' && shell !== 'zsh') {throw new Error(`ensureInstallImage(${shell}): shell must be bash or zsh`);}@@ -767,7 +774,7 @@ export async function ensureInstallImage({ cwd: repoRoot });if (inspect.exitCode === 0 && inspect.stdout.trim() === architecture) {- return imageTag;+ return { imageTag, platform };}const built = await exec(@@ -793,35 +800,17 @@ export async function ensureInstallImage(throw err;}- return imageTag;+ return { imageTag, platform };}export async function runInstallContainer(options: RunInstallContainerOptions): Promise<ExecResult> {- const { imageTag, cmd, env, labels } = options;- const shellMatch = /^composio-e2e-install:(bash|zsh)$/.exec(imageTag);- if (!shellMatch) {- throw new Error(- 'runInstallContainer({ imageTag, ... }): expected composio-e2e-install:<bash|zsh>'- );- }+ const { imageTag, shell, platform, cmd, env, labels } = options;if (!Array.isArray(cmd) || cmd.length === 0) {throw new Error('runInstallContainer({ cmd, ... }): cmd must be a non-empty array');}- const shell = shellMatch[1] as InstallShell;- const inspect = await exec('docker', [- 'image',- 'inspect',- '--format',- '{{.Architecture}}',- imageTag,- ]);- if (inspect.exitCode !== 0) {- throw new Error(`Failed to inspect Docker image ${imageTag}: ${inspect.stderr}`);- }- const platform = inspect.stdout.trim() === 'arm64' ? 'linux/arm64' : 'linux/amd64';const dockerArgs = ['run','--rm',diff --git a/ts/e2e-tests/_utils/src/index.ts b/ts/e2e-tests/_utils/src/index.tsindex 782da117b..4e26a48c6 100644--- a/ts/e2e-tests/_utils/src/index.ts+++ b/ts/e2e-tests/_utils/src/index.ts@@ -20,4 +20,5 @@ export {ensureInstallImage,runInstallContainer,type ExecResult,+ type InstallImage,} from './image-lifecycle';diff --git a/ts/e2e-tests/cli/install/e2e.test.ts b/ts/e2e-tests/cli/install/e2e.test.tsindex 9b3a8b730..ba361d583 100644--- a/ts/e2e-tests/cli/install/e2e.test.ts+++ b/ts/e2e-tests/cli/install/e2e.test.ts@@ -6,6 +6,7 @@ import {resolveInstallE2EConfig,runInstallContainer,type ExecResult,+ type InstallImage,} from '@e2e-tests/utils';import { INSTALL_E2E_LOCAL_RELEASE_TAG } from '@e2e-tests/utils/const';import { startInstallReleaseServer, type InstallReleaseServer } from './release-server';@@ -14,7 +15,7 @@ const config = resolveInstallE2EConfig();const repoRoot = resolve(import.meta.dir, '../../../..');const timeout = 600_000;-let imageTag = '';+let image: InstallImage | undefined;let releaseServer: InstallReleaseServer | undefined;function assertSuccess(result: ExecResult): void {@@ -49,8 +50,12 @@ function installerEnvironment(): Record<string, string> {}async function run(script: string): Promise<ExecResult> {+ if (!image) {+ throw new Error('Install image is not ready');+ }return runInstallContainer({- imageTag,+ ...image,+ shell: config.shell,cmd: [config.shell, '-lc', script],env: installerEnvironment(),});@@ -68,7 +73,7 @@ beforeAll(async () => {releaseDir: config.releaseDir!,});}- imageTag = await ensureInstallImage(config.shell, {+ image = await ensureInstallImage(config.shell, {repoRoot,platform: releaseServer?.platform,});