Sobes.tech
Junior

What is the difference between CI and CD?

sobes.tech AI

Answer from AI

CI (Continuous Integration) is a practice of automatically merging changes into a shared repository and subsequently verifying them through automated tests and builds.

# Example of a simple CI scenario
def build_and_test():
    print("Building the project...")
    # Build commands (e.g., pip install)
    print("Running tests...")
    # Test commands (e.g., pytest)
    print("CI completed.")

build_and_test()

Main goals of CI:

  • Early detection of conflicts and integration errors.
  • Reducing time and effort for integration.
  • Ensuring the stability of the codebase.

CD can mean:

  • Continuous Delivery: An extension of CI where, after all CI processes pass successfully, changes are automatically prepared for deployment. Deployment to production can be manual but is based on a ready artifact that has passed all checks.

  • Continuous Deployment: Further extension of CD (Delivery), where, after all automated tests and checks pass successfully, changes are automatically deployed to production without manual intervention.

Key differences:

Aspect CI (Continuous Integration) CD (Continuous Delivery/Deployment)
Main goal Code integration and testing Deployment readiness / Automatic deployment
CI result Integrated and tested code Ready-to-deploy artifact / Code deployed to production
Actions after build Testing and quality check Deployment preparation / Automatic deployment
Manual intervention Possible but minimal (for error correction) Required for delivery to production (Delivery) / Not required (Deployment)

CI is the foundation for CD. It is impossible to effectively implement continuous delivery or deployment without established continuous integration processes.