Azure DevOps by Microsoft Azure is one of the leading tools that automate CI/CD’s process and in turn supports automatic builds and code projects to make them available to others. The Azure pipelines combine Continuous Integration (CI) and Continuous Delivery (CD) to consistently test and build the code and ship it to the target environment.
What is a CI/CD Pipeline?
A CI/CD pipeline is used to automate the process of continuous integration and continuous deployment. The pipeline facilitates the software delivery process via stages like Build, Test, Merge, and Deploy.
In simple words, a pipeline may sound like an overhead, but it isn’t. Instead it is a runnable specification of steps that reduce developers’ manual work by delivering a new version of a software productively and saves time.
Stages of a CI/CD Pipeline:
- Source Stage: In most cases, when a change is attempt to the central repository, a pipeline run is trigger. These triggers are set by the CI/CD pipeline tool in the source stage.
- Build Stage: The combination of source code and its dependencies when building into a runnable instance corporate to the end-user application. The built-in application languages like Java need compilation too which is done in the build stage. If docker images are to be construct that can also be facilitate in this stage. Failing this stage marks a potential error in the code or its dependencies.
- Test Stage: This stage corresponds to automated tests running to validate our code and its behaviour accordingly. This stage acts as a sieve that prevents the bugs from reaching the end-user. There can be multiple stages, from smoke tests to end-to-end integration tests. Failure at this stage will expose errors in the code.
- Deploy Stage: Once we have a runnable code, the deployment is processed with all predefined tests passed. There are a lot of stages like “Beta,” “Staging,” etc., for the product team. A “Production” stage for the end-users is also present.
What Is Azure DevOps?
Azure DevOps is a collection of services given by Microsoft Azure. It provides development services for a team to support, plan, collaborate, build, and deploy applications. It provides integrated features in a browser or an IDE(Integrated Development Environment).
What Is Pipelines in Azure?
The Azure CI/CD pipeline simplifies continuous integration and continuous delivery (CI/CD) in the application development process. We can start from the source stage with existing code on GitHub or on-premise containers. The Azure Repository can maintain a central repository, and the Azure pipelines maintain build and release pipelines for the given project. The Azure DevOps CI/CD process is a crucial process with all the required dev services.
Apart from continuous integration and continuous deployment with Azure DevOps, these pipelines are use to construct build-deploy-test workflows used mainly in Continuous Testing (CT). This tests the changes in a fast and scalable routine.
Advantages:
- Version Control Systems: Having the code into a version control system is the first step of building an Azure CI/CD pipeline. We can manage our source code in GitHub, Bitbucket, Subversion, or any other Git repository. It also supports Team Foundation Version Control (TFVC).
- Programming Languages and Application Types: we can use different languages with Azure pipelines like Java, Ruby, C, C++, Python, PHP, Go, and JavaScript.
- Deployment Targets: The applications with Azure CI/CD pipelines can be deploy to multiple target environments. This includes Virtual Machines, Containers, or any On-prem or Cloud Platform.
- Pricing: It is free for public projects. But, for private projects, you can run up to 1800 minutes of pipeline jobs free per month.
How To Build an Azure CI/CD Pipeline
To create an Azure CI/CD Pipeline, you need to follow the steps outlined below:
- Create an ASP.NET sample DevOps project using Azure DevOps Starter resource in Azure.
- Examine Azure CI/CD pipelines configured by Azure DevOps Starter.
- Clone the sample DevOps project to the system.
- Commit the code and execute CI/CD.
Creating an ASP.NET DevOps Project Using Azure DevOps Starter
Azure DevOps project simplifies the setup of CI/CD pipelines in Azure. Here, we will create a new DevOps project by following the steps below:Sign in to our Azure account at the Microsoft Azure Portal.
Select the + Create a Resource button under the Azure Services, and then search for DevOps Starter
Then choose the DevOps Starter and click on Create.
Select .NET as shown in the below figure, and click Next.
We can also toggle over and select the Add a Database option if needed. When we’re done, choose Next.
we can deploy your application either to Windows Web App or Virtual Machine. The Windows Web App is the default deployment target, but we can choose a Virtual machine. Choose and click Next.
On the next screen, provide the Project name, Azure DevOps Organisation, Subscription, and Web app name (Web app name should be unique in Azure). we can change the location from the default, which is South Central US.
You can select the Additional settings if we want to change the web app or database parameters.
When the settings are completed, choose Done.
Once the deployment is done, select Go to resource to view it.
The Azure DevOps CI/CD Project is created, the Azure resources pane will take some minutes to load. The project also creates:
- A team project with sample .NET code repository.
- An Azure Web App and Azure SQL Database (if the database toggle was selected) in Azure.
- Build Pipeline to compile and test the application.
- Release Pipeline to deploy the application.
We can now collaborate with your team on the ASP.NET Core App with an automated CI/CD process that deploys the latest change to the website.
On the right pane of Azure resources, click on the Browse button to view the application.
Conclusion:
Azure DevOps helps enterprises to plan smarter, collaborate faster, and ship better within the set of dev services. The automated Pipeline setup also provides the test, build, and deployment of the application in an easeful manner.
This is how we can actually use and configure the continuous integration and continuous deployment with Azure DevOps and Azure CI/CD Pipeline Architecture.