Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/commands/agent/interactive/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export async function deployAgent(
client: XpanderClient,
_agentId?: string,
skipDeploymentConfirmation: boolean = false,
skipLocalTests: boolean = false,
) {
console.log('\n');
console.log(chalk.bold.blue('✨ Agent deployment'));
Expand Down Expand Up @@ -78,6 +79,7 @@ export async function deployAgent(
deploymentSpinner,
currentDirectory,
config.agent_id,
skipLocalTests,
);

if (!imagePath) {
Expand Down
8 changes: 7 additions & 1 deletion src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function configureDeployCommand(program: Command): Command {
.description('Deploy agent')
.option('--profile <n>', 'Profile to use')
.option('--confirm', 'Skip confirmation prompts')
.option('--skip-local-tests', 'Skip local Docker container tests')
.action(async (agentId, options) => {
const client = createClient(options.profile);

Expand All @@ -25,7 +26,12 @@ export function configureDeployCommand(program: Command): Command {
return;
}

await deployAgent(client, resolvedAgentId, options.confirm);
await deployAgent(
client,
resolvedAgentId,
options.confirm,
options.skipLocalTests,
);
});

return operationsCmd;
Expand Down
14 changes: 10 additions & 4 deletions src/utils/custom_agents_utils/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ const ensureDockerRunning = async (
*
* @param contextPath - Path to the Docker build context (directory with Dockerfile).
* @param imageName - Name for the Docker image.
* @param skipLocalTests - If true, skip local Docker container tests.
* @returns Full path to the resulting .tar.gz archive.
*/
export const buildAndSaveDockerImage = async (
deploymentSpinner: ora.Ora,
contextPath: string,
imageName: string,
skipLocalTests: boolean = false,
): Promise<string | undefined> => {
const resolvedContext = path.resolve(contextPath);
const fullImageName = `${imageName}:latest`;
Expand Down Expand Up @@ -101,10 +103,14 @@ export const buildAndSaveDockerImage = async (
resolvedContext,
]);

// Test the image locally before proceeding with export
const testPassed = await testDockerImage(deploymentSpinner, imageName, 10);
if (!testPassed) {
return;
// Test the image locally before proceeding with export (unless skipped)
if (!skipLocalTests) {
const testPassed = await testDockerImage(deploymentSpinner, imageName, 10);
if (!testPassed) {
return;
}
} else {
deploymentSpinner.text = 'Skipping local tests (--skip-local-tests flag)';
}

deploymentSpinner.text = 'Exporting your AI Agent files';
Expand Down