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: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ npx tsx ci/main.ts build-local e2e # Build only E2E test image
# Image Lifecycle Management Commands (CI/Deployment with specific tags)
npx tsx ci/main.ts manage-image-lifecycle build <environment> <component> <tag> # Build only
npx tsx ci/main.ts manage-image-lifecycle publish <environment> <component> <tag> # Publish only
npx tsx ci/main.ts manage-image-lifecycle deploy <environment> <component> <tag> # Deploy (unimplemented)
npx tsx ci/main.ts manage-image-lifecycle deploy <environment> <tag> # Deploy all components

# Docker Compose orchestration (direct docker-compose commands)
npm run docker:up # Start services using latest tag (foreground)
Expand Down
29 changes: 17 additions & 12 deletions ci/commands/manage-image-lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ class ImageLifecycleManager {
return await this.publishImage(component);
}

async deployImage(component: Component): Promise<string> {
async deployAllComponents(): Promise<string> {
let changeSetId: string | null = null;

console.log(`🚀 Starting deployment for ${component.toUpperCase()}`);
console.log(`🚀 Starting deployment for all components`);
console.log(` Environment: ${this.config.environment}`);
console.log(` Tag: ${this.config.tag}`);

Expand All @@ -163,7 +163,7 @@ class ImageLifecycleManager {
const siClient = new SystemInitiativeClient();

// Step 1: Create a new change set
const changeSetName = `Deploy ${component.toUpperCase()} - ${this.config.tag} - ${new Date().toISOString()}`;
const changeSetName = `Deploy All Components - ${this.config.tag} - ${new Date().toISOString()}`;
console.log(`📝 Creating change set: ${changeSetName}`);

const changeSetData = await siClient.createChangeSet(changeSetName);
Expand Down Expand Up @@ -203,12 +203,12 @@ class ImageLifecycleManager {
await siClient.forceApplyChangeSet(changeSetId);

console.log(`✅ Change set applied successfully`);
console.log(`🎉 Deployment complete for ${component.toUpperCase()}`);
console.log(`🎉 Deployment complete for all components`);

return `Deployed ${component} with tag ${this.config.tag}`;
return `Deployed all components with tag ${this.config.tag}`;

} catch (error) {
console.error(`❌ Deployment failed for ${component.toUpperCase()}: ${error}`);
console.error(`❌ Deployment failed: ${error}`);
throw error;
} finally {
// Clean up the change set
Expand All @@ -225,6 +225,15 @@ class ImageLifecycleManager {
}

async executeAction(action: ImageAction, components: Component[]): Promise<void> {
// Handle deploy as a special case - it always deploys all components in one operation
if (action === 'deploy') {
const result = await this.deployAllComponents();
console.log("");
console.log(`🎉 ${result}`);
return;
}

// Handle other actions (build, publish, push) that work on individual components
console.log(`🚀 Starting image ${action} process`);
console.log(`📋 Configuration:`);
console.log(` Environment: ${this.config.environment}`);
Expand Down Expand Up @@ -259,9 +268,6 @@ class ImageLifecycleManager {
case 'push':
imageRef = await this.pushImage(component);
break;
case 'deploy':
imageRef = await this.deployImage(component);
break;
default:
throw new Error(`Unknown action: ${action}`);
}
Expand Down Expand Up @@ -307,9 +313,8 @@ export async function manageImageLifecycle(args: string[]): Promise<void> {
const manager = new ImageLifecycleManager(environment, tag);

if (action === 'deploy') {
// Deploy always handles all components - no need to specify
const allComponents: Component[] = ['api', 'web', 'e2e'];
await manager.executeAction(action, allComponents);
// Deploy always handles all components - no component parameter needed
await manager.executeAction(action, []);
} else {
// For build/publish, handle individual or all components
if (componentArg === 'all') {
Expand Down
4 changes: 2 additions & 2 deletions ci/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ const commands: Command[] = [
},
{
name: "manage-image-lifecycle",
description: "Unified image lifecycle management (build, publish, push)",
usage: "manage-image-lifecycle <action> <environment> <component> <tag> (action: build|publish|push|deploy, component: api|web|e2e)",
description: "Unified image lifecycle management (build, publish, push, deploy)",
usage: "build|publish|push: <action> <environment> <component> <tag> | deploy: deploy <environment> <tag>",
execute: manageImageLifecycle,
},
];
Expand Down