Back to Dockerlabs

CI - CD using Docker & Azure DevOps integrated with MS Teams

advanced/ci-cd/cicd-azuredevops.md

latest4.6 KB
Original Source

CI - CD using Docker & Azure DevOps integrated with MS Teams

Tested Infrastructure

<table class="tg"> <tr> <th class="tg-yw4l"><b>Platform</b></th> <th class="tg-yw4l"><b>URL</b></th> <th class="tg-yw4l"><b>Reading Time</b></th> </tr> <tr> <td class="tg-yw4l"><b>Azure DevOps</b></td> <td class="tg-yw4l"><b>https://dev.azure.com/sujithar37/RWODevOpsTest</b></td> <td class="tg-yw4l"><b>3 min</b></td> </tr> </table>

Introduction

This guide will explain a few core concept about CI-CD pipeline using Azure DevOps for Docker based deployments. Also, this could be more likely a generic CI-CD template which can even customize in depth by going through the relevant documentations and it has been described very well in the configuration files(azure-pipelines.yml && Dockerfile) and how we can play with those etc.

This guide has 3 sections as follows,

  • Pre-requisite - Things to learn/notice before you jump in
  • Problem Statement - Of course, what is the problem?
  • Solution - Okay, Here is the solution of your problem!!!

Let's get started,

Pre-requisite

Problem Statement

  • Enable CI-CD pipeline in one of the Github project using below standards,

CI [Continuous Integration]

  1. Since it has been written in C++, use below the command to generate the build file named as 'binary.out'
bash
g++ -std=c++11 -I/usr/include/boost/asio -I/usr/include/boost -o binary.out main.cpp connection.cpp connection_manager.cpp mime_types.cpp reply.cpp request_handler.cpp request_parser.cpp server.cpp -lboost_system -lboost_thread -lpthread 
  1. For every commits or manual queue, the CI needs to be triggered and the respective build information should be updated in the 'readme.txt' file with the below format,
text
  build_number = $a.$b.$c where $a is a build pipeline variable that can be set , $b is some incremental value, and $c is git commit SHA

CD [Continuous Deployment]

  1. Bring up a Docker image with the generated builds and finally push that into Docker Hub.

Solution

  1. Import the Github project into Azure DevOps repository since it can provide an all-in-one solution which starts from Azure Boards to Artifacts.

  2. Checkout the azure-pipelines.yml which contains the detailed instructions how the CI has been built.

  3. Checkout the Dockerfile which contains the detailed instructions how the docker image has been built as soon as CI is done.

  4. Enable the CD process through a Release pipeline which uses the RWO_Artifacts and the below task picker docker-build&push from market place

  5. Finally the generated docker image will be available at DockerHub-sujithar37/rwobinary as part CI-CD process

  6. The above deployment can be done either via automated or approval through MS Teams channel.

Maintained by:

Sujith Abdul Rahim