Continuous Delivery process - yurkka23/iMusic_team GitHub Wiki

Overview

This document details the Continuous Delivery (CD) process for the Backend iMusic project. Building upon Continuous Integration (CI), CD automates the release of tested code changes to production, emphasizing safety and sustainability. The implemented strategy utilizes a blue-green deployment approach to minimize risk and downtime.

Goals

  • Reduce Deployment Risk: Employ automation deployment to minimize failure and impact.
  • Increase Deployment Frequency: Enable faster and more frequent releases of features and fixes.
  • Improve Release Reliability: Establish a consistent and repeatable automated deployment.
  • Enhance Team Efficiency: Automate deployment tasks, allowing developers and operations to focus on other priorities.
  • Facilitate Faster Feedback: Get new versions to users quickly for rapid iteration based on feedback.

CD Pipeline Stages

Build and Test This initial stage focuses on code quality and artifact creation.

  • Trigger: Automatic on main branch pushes, manual via workflow_dispatch.

  • Steps:

    • Checkout: Retrieves the latest code.
    • Setup .NET: Configures the necessary .NET SDK.
    • Set Build Version: Determines the application version.
    • Restore Dependencies: Downloads and installs NuGet packages.
    • Linting: Performs static code analysis.
    • Build: Compiles the solution in Release mode.
    • Testing & Coverage: Executes unit and integration tests, collects code coverage in TestResults.
    • Coverage Report: Uploads the Cobertura coverage report as a GitHub artifact.
    • Publish: Publishes the application to the directory.
    • Build Report: Generates a build-report.md summarizing the build.
    • Upload Build Report: Uploads the build-report.md as a GitHub artifact.
    • Publish Artifact: Uploads the compiled application.
  • Outcome: Successful completion yields build artifacts ready for deployment and the build_version for subsequent stages.

Deploy to Azure This stage deploys the built artifact to a designated environment.

  • Trigger: Automatic upon successful build-and-test.

  • Environment: Deploys to the environment specified by the target_environment.

  • Steps:

    • Download Artifact: Retrieves the webapp-* artifact.
    • Azure App Service Deployment: Deploys the artifact to the Azure App Service (iMusic-blue or iMusic-green) using the Publish Profile secret.
  • Outcome: Application deployed to the selected environment. Success/failure here can trigger rollback.