Adopt Component-Specific CI/CD Build Pipeline Architecture
Context
The Swiss AI Hub platform consists of multiple distinct components (agents, API, bot, pipelines, web) that previously shared a monolithic build process. As the platform matured, the need arose for more granular build control, allowing individual components to be built, tested, and deployed independently while maintaining integration capabilities.
The existing CI/CD pipeline was insufficient for:
- Building individual microservices with different dependencies and requirements
- Supporting multiple deployment environments (local, nightly, GPU, production)
- Managing version coordination across components
- Optimizing build times by only rebuilding changed components
The monorepo structure needed to be preserved while enabling component-specific build optimization and deployment flexibility.
Decision Drivers
- Component Independence: Each microservice should have its own build pipeline with appropriate dependencies
- Version Management: Support for different versioning strategies (local development, nightly builds, semantic versioning)
- Environment Flexibility: Build artifacts suitable for different deployment environments
- Parallel Processing: Enable concurrent building of independent components
- Resource Optimization: Different components have different build requirements (Node.js vs Python vs container-only)
- Deployment Coordination: Maintain ability to deploy complete platform while enabling component-specific deployments
Decision
We will implement a component-specific CI/CD build pipeline architecture with the following structure:
Decision 1: Component-Specific Build Workflows
Create dedicated GitHub Actions workflows for each major component:
- Agent Builds (
build-agents.yml): Build all agent containers and applications - API and Bot Builds (
build-api-and-bot.yml): Build API and bot services together due to shared dependencies - Pipeline Builds (
build-pipelines.yml): Build Dagster-based data processing pipelines - Dagster Builds (
build-dagster.yml): Build Dagster orchestration containers - Web Builds (
build-web.yml): Build frontend applications with Node.js-specific pipeline
Decision 2: Centralized Build Action with Component Parameters
Extend the existing build_image action to support component-specific parameters:
- Flexible Path Support: Allow specification of build context and Dockerfile paths
- Multi-Stage Builds: Support complex build scenarios with multiple stages
- Registry Management: Consistent image naming and registry push strategies
- Version Coordination: Coordinate version tags across all component builds
Decision 3: Event-Driven Build Coordination
Implement repository dispatch events for coordinating builds:
- Chain Dependencies: Use
repository_dispatchinstead ofworkflow_runfor better workflow independence - Structured Job Coordination: Break complex workflows into discrete, coordinatable jobs
- Conditional Execution: Enable conditional building based on changed components
Decision 4: Multi-Environment Build Support
Support building for different deployment environments:
- Local Development Builds: Quick builds for local testing
- Nightly Builds: Automated builds from latest development branch
- Release Builds: Versioned builds for production deployment
- Feature Branch Builds: On-demand builds for testing specific features
Consequences
Positive
- Build Efficiency: Only changed components are rebuilt, significantly reducing CI/CD time
- Parallel Processing: Independent components can be built concurrently, improving overall build speed
- Component Isolation: Build failures in one component don't block others
- Resource Optimization: Each build workflow uses only the resources needed for that component
- Deployment Flexibility: Components can be deployed independently or as a complete platform
- Development Velocity: Teams can iterate faster on individual components without full platform rebuilds
- Clear Separation: Each component's build requirements and dependencies are explicitly defined
Negative
- Complexity: Multiple build workflows require more maintenance and coordination
- Version Management: Coordinating versions across multiple components becomes more complex
- Integration Testing: Need additional processes to ensure component compatibility
- Build Configuration Duplication: Some configuration may be duplicated across workflows
- Debugging Overhead: Troubleshooting build issues requires understanding multiple workflow files
Neutral
- Monitoring Requirements: Need comprehensive monitoring across all component build pipelines
- Documentation: Requires clear documentation of build dependencies and coordination
- Tooling: Development tools need to understand the component-specific build structure
- Testing Strategy: Need both component-specific and integration testing approaches
Implementation Notes
This decision enables:
- Targeted Builds:
gh workflow run build-agents.ymlto build only agent components - Environment-Specific Deployment: Different components can be built for different environments
- Rapid Iteration: Developers can quickly test changes to specific components
- Scalable Architecture: New components can easily be added with their own build pipelines
- Resource Efficiency: Build resources are allocated based on actual component needs
The architecture maintains the benefits of the monorepo (shared dependencies, coordinated releases) while providing the flexibility of component-specific build and deployment capabilities.
