V. Start early with CICD and Automation
Continuous Integration for code builds and Continuous Delivery for software releases
Do you remember the times when software used to be compiled on developers’ machines and then released, or in other words copied, to the host machine? Sounds crazy now, but that’s how release process used to look like in many organisations.
If you are still doing this then start thinking containers as soon as you can, and keep reading this article to learn how you can add robust CICD and Automation to your code builds and software releases
.
Continuous Integration for Docker Image Builds
This is the Continuous Integration (CI) stage where changes to your code base are made on a frequent, continuous
, basis and merged, integrated
, into the main code branch. From that point a version of your software is built and a potential candidate for release is created.
This process will apply to every single deployable containerised component of your Kubernetes solution. For instance this could be a build for a single API
(Inner/Outer) or App
(Mesh Application) component of your Mesh App and Service Architecture.
At a high level you’ll need to automate the following Build Tasks
using your chosen DevOps tool:
- Run code build and unit tests as part of
Pull Request
- Assign unique
Version
number to your Build- Build
Docker Image
from Dockerfile and Tag it with Version- Push Image to
Development Container Registry
At stage 4 above we assume you have one Container Registry per environment: Development, Staging and Production Images. An alternative is to have one single Container Registry for all environments, which makes the infrastructure maintenance easier but security wise less secure.
Continuous Delivery for Kubernetes Deployments
For the Continuous Delivery(CD) stage all we are concerned with is to frequently, continuously
, pushing, delivering
, a particular build to our environments for testing and finally Production release. We already have a release candidate which in our case is the Image
we’ve built, Tagged with Version number and pushed to Development Container Registry.
Similar to the CD
stage, this procedure applies to every single deployable containerised component of your Kubernetes solution - API, App and so on.
At a high level you’ll need to automate the following Release Tasks
using your chosen DevOps tool:
- Package
Helm Chart
for release referencing Image with Version fromDevelopment Container Registry
- Release the
Helm Chart Package
to Development environmentPromote
Docker Image from Development Container Registry toStaging Container Registry
- Package Helm Chart for release referencing Image with Version from
Staging Container Registry
- Release the Helm Chart Package to
Staging
environment- Promote Docker Image from Staging Container Registry to
Production Container Registry
- Package Helm Chart for release referencing Image with Version from
Production Container Registry
- Release the Helm Chart Package to
Production
environment
The example above assumes one Container Registry per environment: Development, Staging and Production Images. We’ve also bypassed Approval gates here as probably not every single release will always get delivered straight through Development => Staging => Production.