CI/CD and Cloud Deployment Configuration

Ramandeep Singh
3 min readJun 5, 2018

--

A quick introduction to CI/CD and cloud deployment

CI — Continuous Integration: involves starting an automated build (and possibly running tests) whenever new code is committed to or checked into the team project’s source control repository. This gives you immediate feedback that the code builds and can potentially be deployed.

CD — Continuous Deployment/Delivery: involves starting an automated deployment process whenever a new successful build is available.

Together, CI and CD mean that any code changes you commit to your repository are quickly validated and deployed to a test server, a live web site, or wherever you need it.

Cloud Environments

The deployment environments for a cloud application can be summarized as follows:

  • Development
  • Testing
  • Staging
  • Production

In cloud terminology, slots and environment terms are used aplenty. A cloud environment can have multiple slots and one can deploy an application to any slot in any environment. Development, testing and production environments are self-explanatory. Information about staging slot is mentioned below.

Staging Slot

Staging slot is often used as a testing ground for the final production build before deploying it on the production slot. Some of the benefits of a staging slots are as follows:

  • One can verify if a deployment works alright, before swapping it with production.
  • One can instantly swap it with the production slot thereby deploying a new release without any downtime. Behind the scenes, it just swaps the domain names of the staging and production slots so the swap is instantaneous.

Deployment Setup

Most of the projects these days use Git for source control. In Git, we use different branches to achieve different purposes:

  • Master: main branch of a project.
  • Development/Testing: branches for feature development and defect fixes.
  • Release: Branch containing potentially releasable code.
  • Production: Branch containing production code.
  • More… based on project requirements.

Based on the above, we can define a CI/CD pipeline diagram that we can follow for any cloud application:

A sample cloud deployment configuration

The deployment diagram is split up into 3 different environments. It achieves the following demands for a fully automated CI/CD pipeline project:

  • It should be possible to deploy a development as well as production type of build on both development and test/QA environments.
  • It should be possible to deploy only production builds on the production environment.
  • It should be possible to have continuous deployment to production using a production branch.
  • It should be possible to deploy a build to production environment without any downtime (by swapping staging with production slot).

In addition to the above, it should also be possible to manually deploy any branch to the development and test environments.

Deployment configuration that uses an additional last-known-good slot

An additional last-known-good slot can be added so that we have a backup in case the newly deployed application needs to be rolled back:

Image courtesy: https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/app-service-web-app/basic-web-app

I hope the above will give you a good idea about different cloud environments and how to develop and manage a fully automated CI/CD pipeline for your cloud apps.

--

--