Fast cloud deployment: CI/CD from an Azure Marketplace partner
Published Aug 19 2020 08:35 AM 2,514 Views

The cloud revolution solved one of the basic problems of infrastructure: ensuring scalability easily and simply. With Microsoft Azure services, you can now expand computing capacity on demand. While getting access to extra infrastructure is easier than ever before, the same cannot be said for the deployment tools that take advantage of this infrastructure. That’s where an Azure Marketplace partner like Codefresh can help software developers.

 

Kostis Kapelonis, Developer Advocate at Codefresh, explains how his company’s continuous integration/continuous delivery (CI/CD) solution in the Azure Marketplace helps companies stay competitive by delivering new features to production in a fully automated manner and at a steady pace. Adding new features quickly can help any company adapt and pivot to market needs, offering its customers the best service possible without lengthy delays. Especially in the case of important security updates, the speed at which a company can upgrade systems to a new version is paramount.

 

Codefresh CI/CD has native support for Azure and a heavy focus on cloud services such as Docker containers and Kubernetes clusters. It enables developers to take advantage of Azure services and minimize the time from feature inception to deployment.

 

Codefresh image 1.png

 

 

 

Codefresh acts as a central hub for several related Azure services:
• Developers use Azure Git repositories to create new features for their company
• Codefresh continuously builds and tests the source code from the repository
• New releases of a software product are packaged in one or more Docker containers and stored in Azure Container Registry
• The final release is deployed to Azure Kubernetes

Codefresh can also take advantage of Azure SSO/AD installations to help enterprise companies provide a unified way of credential usage among employees.

 

How to store Docker images in the Azure Container Registry
One of the most basic functions of a CI/CD system is the creation of software artifacts comprising a software application. Especially for cloud services, Docker images have become the de facto standard for application packaging and deployment.

 

Using the Azure Container Registry in Codefresh is a straightforward process. First, you connect your Azure Registry in your Codefresh account using the Integration UI screen.

 

Docker image.png

 

Then you can use the registry in any deployment pipeline, simply by referencing it by name. A starting workflow is one that has only two steps:
• Checking out source code from Azure Git
• Building a Docker image and storing it in the Azure Container Registry.

This can be easily accomplished in Codefresh with a pipeline of two steps (a git-clone step and a build step).

 

Pipeline image.png

 

Each pipeline in Codefresh is defined with declarative YAML format. Here is the respective pipeline definition:


version: "1.0"
stages:
- "clone"
- "build"
steps:
clone:
title: "Cloning repository"
type: "git-clone"
repo: "kostis-codefresh/trivial-go-web"
revision: "master"
stage: "clone"

build:
title: "Building Docker image"
type: "build"
image_name: "my-go-app"
working_directory: "${{clone}}"
tag: "latest"
dockerfile: "Dockerfile"
registry: azure
stage: "build"

 

This pipeline has a clone step that checks out the source code and a build step that creates the Docker image and also pushes it to ACR.

 

Notice the “registry” property in the build steps that define our Azure registry as the target of the Docker push action.

 

After the pipeline has run, the Docker image is stored in the Azure Container Registry.

 

Azure Container Registry.png

 

How to deploy applications to Azure in an automated manner
Creating a Docker image is only one part of the software delivery process. The other part is to deploy the image artifact into production. Codefresh also has native integration for Azure Kubernetes Service (AKS).

 

First, you need to connect your Azure cluster in your Codefresh account.

 

Codefresh account.png

 

Once the cluster is connected, you can easily deploy any application in an ad hoc manner using the deployment GUI of Codefresh.

 

Configure Kubernetes Service.png

 

Manual application deployments are a welcome solution for test environments and quick prototypes, but for production deployments, a delivery pipeline is the better choice, as it completely automates the software delivery process.

 

Image 7- Delivery pipeline.png

 

This delivery pipeline includes an extra deploy step that instructs the Azure Kubernetes cluster to pull the Docker image in the cluster and create an application deployment.

 


Here is the full pipeline definition:

version: "1.0"
stages:
- "clone"
- "build"
steps:
clone:
title: "Cloning repository"
type: "git-clone"
repo: "kostis-codefresh/trivial-go-web"
revision: "master"
stage: "clone"

build:
title: "Building Docker image"
type: "build"
image_name: "my-go-app"
working_directory: "${{clone}}"
tag: "latest"
dockerfile: "Dockerfile"
registry: azure
stage: "build"
deploy_to_aks:
title: Deploy App
type: deploy
stage: deploy
kind: kubernetes
cluster: 'mydemoAkscluster@BizSpark Plus'
namespace: default
service: sample
candidate:
image: '${{build_image}}'
registry: azure

 

Again, notice the “registry” and “cluster” properties that explain how the Docker image deployed to the Azure Kubernetes cluster will also come from the Azure registry.

 

After the pipeline has finished running, you can verify the application deployment from the Codefresh Kubernetes dashboard and get more details such as health status or the number of replicas the application is using:

 

Image 8- Status.png

 

 

Conclusion
Codefresh makes the creation of Docker images and their deployment to Azure a very easy process. With built-in integration for AKS, ACR, Azure SSO, and Azure Git repositories, it is an extremely fast way for companies to take advantage of Azure scalability for any software product in any sector.

 

Create a free Codefresh account today and start deploying applications to Azure now.

Version history
Last update:
‎Aug 19 2020 08:35 AM
Updated by: