Azure-Devops CI/CD pipeline

Azure-Devops

Table of contents

Here we are to learn AZure-Devops. In Azure Devops we have five components, they are : Azure-Boards, Azure-Repos, Azure-pipelines, Azure-Artifact, And Test-plans.

Azure-Boards: Azure Boards provides software development teams with the interactive and customizable tools they need to manage their software projects. It provides a rich set of capabilities including native support for Agile, Scrum, and Kanban processes, calendar views, configurable dashboards, and integrated reporting. These tools scale as your business grows.

Quickly and easily track work, issues, and code defects associated with your project. The Kanban board, shown in the following image, is just one of several tools that allows you to add, update, and filter user stories, bugs, features, and epics.

Azure-Repos: Azure-Repos is a Version control systems are software that help you track changes you make in your code over time. As you edit your code, you tell the version control system to take a snapshot of your files. The version control system saves that snapshot permanently so you can recall it later if you need it. Use version control to save your work and coordinate code changes across your team.

Even if you're just a single developer, version control helps you stay organized as you fix bugs and develop new features.

Pipelines:

Continuous Integration

Continuous Integration (CI) is the practice used by development teams of automating, merging, and testing code. CI helps to catch bugs early in the development cycle, which makes them less expensive to fix. Automated tests execute as part of the CI process to ensure quality. CI systems produce artifacts and feed them to release processes to drive frequent deployments.

Here in this article we learn to write CI/CD pipeline from scratch

Go to pipeline section and click on pelines

Click on new pipeline, so that you will start to write CI pipeline, here after clicking on new pipeline it will ask you where is your code i.e source code management tool like GIT, Azure-repos, Bitbucket or Git-lab, so here i have code in Git-hub so ill click on github and ill clone the code

clcik on continue, after that it will ask you on which type of template the code should run and build, in my case its java application so that ill take mavan package to build and run my code

Here we have one option is Agent-pool, Agent pool is nothing but a server, here in Azure-Devops we have two types of Agents, one is Hosted agent and other one is Self-host agent. Hosted agent is a server provided and maintained by the microsoft and hosted agents are our Virtual-machines, Here im using Hosted-agent

In Agent specifications i selected ubuntu-latest and In maven package i configured pom.xml file as shown in the sceen-shot

Now click on save and queue so that youe ci pipeline will run and build pipeline will save in artifact

Now the continuous inegration part is completed and your build pipeline is saved in Artifact "Drop" folder. The next process is Continous delivery and continuous deployment. we will do continuous deployment, for that we write Release pipeline, before that we need to set the production environment either it is kubernetes or any other hosted servers, in my case im using Azure-app service as platform to deploy application, for that i should create web-app in app service, let's do that.

Go to Azure-portal and create App service

Here click on APP-servie and create

Now click on deployment section and enable githubAction-seetings and select the repository where is your code is

Now click on Review and Create

your App-service is created, now you can access by acessing url https link in a browser

After deploying application in app service than you can access the application from the same link.

Now let us write Release pipeline, let's get started

Go to Azure-Devops and click on pipelines section and cick on Release pipeline and create a new release pipeline

Click on tasks and select Deploy on Azure-app service

Here you have to do authentication using Azure-service-connection, authentication required between Azure-Devops and Azure-portal

After authenticating thing you have to do some settings here in Run-time-stack under this select Tomcat 9.0(Tomcat9.0-jre8) and startup command

startup command is

"java -jar /home/site/wwwroot/gs-spring-boot-0.1.0.jar --server.port=80"

Now click on save

Now click on create release

click on create, you release pipeline will run, in first stage it will copy build pipeline from Artifact and test and finally deploy in Azure-App service

So finally you deployed application in production environment

Now go to azure portal and go to app service which you deployed your application and paste that hhtps link in browser now you can access your application