How to build a CI/CD pipeline with Azure and GitHub – TechTarget

Continuous integration/continuous delivery (CI/CD) pipelines are the foundation of modern software development, delivering business value in many ways: streamlined releases, software with fewer bugs and automation that removes many time-consuming and error-prone manual steps. You can develop software without CI/CD, but a CI/CD pipeline makes life much easier if your business uses Agile, cloud-native apps or any distributed application architectures such as microservices.

There is no one-size-fits-all approach to building a CI/CD pipeline. A typical CI/CD pipeline example relies on some prescriptive components -- a CI engine, code repository, test framework -- but an organization's CI/CD plan will likely branch out, depending on its infrastructure and tools and the choice between continuous delivery or deployment. Organizations that rely on cloud-based applications and services may want to run CI/CD through their chosen cloud platform.

Most cloud providers offer a template to quickly set up a CI/CD pipeline. Consider, for example, a CI/CD pipeline that uses GitHub and deploys an application to Microsoft Azure. A service called DevOps Starter provides CI/CD starter templates that enable you to integrate with either GitHub or Azure DevOps and bootstrap a repository with a demo application from source code along with the pipeline definition as code and infrastructure as code (Azure Resource Manager templates). With these in place, the service stitches everything together to present an end-to-end deployment pipeline.

So, let's get started with this step-by-step walkthrough of how to set up a CI/CD pipeline in Azure with GitHub for version control and repository. First, go to the Azure portal, search for devops and select the "DevOps Starter" service.

In the DevOps Starter service pane, click Add which presents a bunch of preloaded templates to choose from. Select the programming language for your application -- in this example, I chose .NET, as well as GitHub for version control and GitHub Actions for pipelines (Azure DevOps is an option as well). Hit the Next: Framework button.

Now, choose the ASP.NET Core framework for our .NET app, as this is a cross-platform framework; later, we can deploy our application on top of Linux containers. Then click Next: Service.

You can select from several Azure services to deploy your application. For this exercise, we will choose Web App for containers, which deploys containers to an Azure App Service, a managed application-hosting platform. Click Next: Create.

Because we chose GitHub for version control and pipelines, the next step will prompt us to authorize connection to GitHub in the Azure portal. Click Authorize and log into GitHub.

Once we have authorized to GitHub, we are presented with several parameters (the final three are specific to deployment on Azure):

Fill in the details and click Review + Create.

After the deployment completes, we can return to the DevOps Service and see that our instance has been created.

Clicking on the instance presents a landing page with the details of the GitHub workflow and corresponding Azure resources.

We confirm the Azure starter service has created a GitHub repository under our specified organization, and it has set up a GitHub Actions CI/CD pipeline to build, test and release our software. Here's the repository layout:

The image below shows the CI/CD task as it runs through GitHub Actions.

Let's dive deeper to understand what's happening inside a single CI/CD build in our example and its three stages.

This job runs a series of steps to build the application:

The primary responsibility in this stage is to take the artifact (the container image from previous job) and deploy it in the environment on the cloud provider, with the required cloud resources, to host the app instance. Specific functions include:

This job runs various functional tests to validate our deployed app is working. Steps include:

This example of a CI/CD pipeline in Azure with GitHub involves only a single environment, but you could chain multiple environments together, with gates on them to control the release of deployed software.

Original post:
How to build a CI/CD pipeline with Azure and GitHub - TechTarget

Related Posts

Comments are closed.