CI/CD Automation Module Development
Specialized development rules for the `ci_cd_automation` module within the Codomyrmex ecosystem. This skill manages CI/CD pipelines, deployment orchestration, and automated software delivery.
Core Functionality
This module handles:
CI/CD pipeline management and orchestrationDeployment automation and strategiesRollback and recovery mechanismsPipeline monitoring and analyticsIntegration with CI/CD platforms (GitHub Actions, Jenkins, etc.)Key Technologies
Python (PEP 8 compliant)CI/CD platforms (GitHub Actions, Jenkins)Container orchestrationDeployment strategiesMonitoring systemsInstructions
1. Module Context & Structure
When working in this module, always reference:
**`README.md`**: High-level overview, setup, and usage**`API_SPECIFICATION.md`**: Programmatic interfaces (functions, classes)**`CHANGELOG.md`**: Log all notable changes here**`SECURITY.md`**: Security considerations for CI/CD processes**`requirements.txt`**: Python dependencies**`docs/`**: In-depth documentation and tutorials**`src/` or `ci_cd_automation/`**: Core module logic**`tests/`**: Unit and integration tests**Critical files:**
`pipeline_manager.py`: Core pipeline management`deployment_orchestrator.py`: Deployment logic`rollback_manager.py`: Rollback and recovery`pipeline_monitor.py`: Monitoring and analytics2. Coding Standards
**General:**
Follow existing coding styles and architectural patterns within the moduleSupplement (don't override) `general.cursorrules` unless explicitly necessaryMaintain consistency with existing codebase conventions**Python-specific:**
Strictly adhere to PEP 8Use extensive type hinting, especially for pipeline configurations and deployment parametersWrite clear, self-documenting code**Pipeline Design:**
Make pipeline definitions declarative and versionableSupport complex dependencies between pipeline stepsEnsure pipelines are reproducible and deterministic**Deployment Safety:**
Implement comprehensive validation before deploymentsAdd health checks for deployed servicesInclude rollback capabilities for all deploymentsHandle partial failures gracefully**Monitoring Integration:**
Log all pipeline activitiesLog all deployment activitiesIntegrate with monitoring systemsProvide visibility into pipeline execution and deployment status3. Testing Requirements
**Mandatory test coverage:**
All new features MUST include tests in `tests/unit/` and/or `tests/integration/`All bug fixes MUST include regression testsCover various pipeline scenarios (success, failure, partial completion)Test deployment strategies (blue-green, canary, rolling updates)Test failure recovery and rollback mechanisms**Testing approach:**
Mock external CI/CD systems for deterministic testsMock deployment targets to avoid external dependenciesEnsure tests are reproducible and isolatedRun existing test suite to verify no regressionsRefer to `ci_cd_automation/tests/README.md` for module-specific test guidelines4. Documentation Standards
Keep the following meticulously up-to-date:
Module `README.md` with current setup and usage instructions`API_SPECIFICATION.md` with all public interfaces`docs/` directory with technical overviewsPipeline configuration documentationDeployment strategy documentationMonitoring setup guides**Include examples for:**
Pipeline definitionsDeployment workflowsCommon use casesIntegration with other modules5. Security & Reliability
**Security requirements:**
Prioritize security in all pipeline and deployment processesImplement secure secret managementEnforce proper access controlsNever commit credentials or secretsFollow principle of least privilege**Reliability requirements:**
Implement comprehensive error handlingAdd retry mechanisms with exponential backoffProvide rollback capabilitiesHandle edge cases and failure scenariosTest failure modes explicitly**Observability requirements:**
Log all pipeline activities with appropriate detailLog all deployment activitiesIntegrate with monitoring and alerting systemsProvide clear error messages and diagnostics**Scalability considerations:**
Design for parallel pipeline executionOptimize resource utilizationSupport efficient deployment strategiesConsider performance implications at scale6. Pre-commit Checklist
Before finalizing any changes:
1. **Documentation**: Update all relevant docs (README, API_SPECIFICATION, CHANGELOG, docs/)
2. **Testing**: Verify all tests pass (`tests/unit/` and `tests/integration/`)
3. **Pipeline validation**: Confirm pipelines execute correctly
4. **Deployment testing**: Verify deployments handle failures gracefully
5. **Integration testing**: Test integration with related modules (`build_synthesis`, `containerization`)
6. **Security review**: Ensure no security vulnerabilities introduced
7. **Performance check**: Verify no performance regressions
7. Integration Points
This module integrates with:
**`build_synthesis`**: Build artifacts for deployment**`containerization`**: Container management and orchestration**External CI/CD platforms**: GitHub Actions, Jenkins, etc.**Monitoring systems**: For observability and alertingEnsure changes maintain compatibility with these integration points.
Constraints
Always supplement (not override) `general.cursorrules` unless explicitly necessaryNever bypass security or validation checksNever commit incomplete pipeline definitionsNever deploy without health checks and rollback capabilitiesAlways prioritize reliability and observability over convenienceExamples
Example pipeline definition structure:
```python
pipeline = PipelineDefinition(
name="deploy_api",
stages=[
Stage("build", steps=[...]),
Stage("test", steps=[...]),
Stage("deploy", steps=[...], rollback_steps=[...])
],
health_checks=[...],
monitoring_config={...}
)
```
Example deployment with safety checks:
```python
deployment = DeploymentOrchestrator(
strategy="blue-green",
validation_steps=[...],
health_checks=[...],
rollback_on_failure=True,
monitoring_enabled=True
)
```