Why Speaking is more Therapeutic than it is Hard

In a troll of moments, all my worries and anxiety vanished like they never existed in my thoughts. I felt inner relief; my sanity strolled back to me and I had a deep sense of clarity. I was excited…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Final Thoughts

There are various tools being used to carry out Continuous Integration and Continuous Delivery for ease of build, testing, and delivery of code projects. Such tools are Azure Pipelines, Jenkins, AWS Code Build/Deploy, GitHub Actions, Bitbucket Pipelines, etc.

The cloud version, Azure DevOps Services is readily available to use on Azure with an account login for the Microsoft Azure portal. Another way involves the on-prem version, Azure DevOps Server which was called Microsoft Teams Foundation Server (TFS), which should be installed separately on a Microsoft Windows Server Machine.

Azure DevOps consists of many features irrespective of the versions, mainly:

Azure Pipelines in Azure DevOps are made up of mainly 06 pillars:

The CI process on Azure DevOps is carried out through “Pipelines” as discussed before.

There are two methods by which we can implement the CI pipeline on Azure. One method is to use the YAML file in which we define the series of steps required for the CI pipeline in the YAML language. This YAML is stored in the code repository, after cloning the repo, the YAML file can be run from the pipeline.

This is what implementing from YAML code looks like:

The other method includes the use of the Classic Editor to implement the pipeline. From that, we can add the steps (UI based) which are available in Azure DevOps to the pipeline using the classic editor in Azure Pipelines.

This is what a classic editor looks like:

In Azure DevOps, almost all the steps required for any project to build and deploy, are readily available irrespective of the editor we use and if we need much more steps to define in the pipeline other than default steps, we can install it from the Azure DevOps marketplace. In simple terms, Classic Editor allows us to edit the steps as UI, and in YAML, editing the steps as code.

The underlying machine or server which is used to run the pipelines is called Azure Pipelines Agents. In order to integrate the code, build and deploy through pipelines, we need at least one agent, and it is only on top of that agent that the pipeline is run. This agent runs only one job at a time and the subsequent runs will be queued until one run is finished.

Azure DevOps offers two types of agents:

The type of agents offered by Microsoft Azure to run our pipelines on top of it. Each time when we run a pipeline, we get a new virtual machine or container and get rid of that computing resource once the job is finished. Next time, the pipeline is run on a separate VM or container. This is the easiest way to run the pipeline as we do not have the overhead of maintaining or upgrading the agents. This type of agent is only supported in Azure DevOps Services (Cloud version), not on Azure DevOps Server. In the basic plan of Azure DevOps Services, Microsoft hosted agents give 1800mins of run time without any charge per month.

At the moment, Microsoft has given the opportunity to select the required OS image for agent from Windows (vs2017-win2016, windows-2019, windows latest or windows-2022), macOS (10.14, 10.15, 11 or latest, 12), and Ubuntu (18.04, 20.04 or latest, 22.04.

2. Self-Hosted Agents

The type of agent that we install, maintain, and upgrade by ourselves in order to run the pipelines. This type of agent should be configured by installing the agent package provided by Azure DevOps agent pool on top of Windows, macOS, Linux distributions, or even on Docker Container. Self-Hosted agents are useful when there is a lot of dependent software required for building the project code as we have control of the machine in which the pipeline agent is installed.

Likewise, with Microsoft Hosted agents, we can only run one job at a time in self-hosted agents. This agent works as a service on the host machine, and we can run the agent interactively, which is more useful for UI testing. We can install multiple agents on one machine but Microsoft suggests that we limit only one agent per machine as it affects the performance. This type of agent is supported in both Azure DevOps Services (Cloud version) and Azure DevOps Server.

The best way to determine what agent to be used is, first run the pipeline on the Microsoft-hosted agents and check whether the code builds and deploys successfully. If it does not work and the project needs more dependent software, move it to run the pipeline on Self-Hosted agents.

Let’s consider an example of the CICD pipeline. This will be a very basic one to get an idea of how CICD is implemented on Azure DevOps Services from cloning the project code, then building the code to get an artifact and deploying the code onto a respective server.

For this example, the classic editor will be used as the implementing method throughout the pipeline and a simple project is built and deployed on IIS using the steps/ tasks available on Azure DevOps. Here, the basic pipeline is designed for a React application.

1. Sign in to Azure DevOps Services using Azure login credentials, then you can see the projects under organization.

2. Select a new Project to create a private project, fill in necessary details and create the project.

3. Create a Pipeline by selecting the Pipeline under Azure Pipelines. (Pipeline named Demo-CI).

4. Follow these steps afterward:

5. Select the required agent pool and add the required steps by pressing ‘+’ on the agent job.

1. Select “Releases” under Azure Pipelines and select “New Pipeline”.

2. Search for IIS deployment from the templates and apply IIS website deployment. The above artifact is deployed in IIS.

3. Then:

Create a deployment group by following:

Then that deployment agent is registered under the Deployment Group.

Here the Staging stage is defined as a manual stage. So, the CD does not do the deployment on staging.

We can run the release manually by “Create Release 🡪 Create”. Otherwise, the continuous deployment trigger should be enabled by selecting the lightning icon.

This is how we can implement a basic CI/CD pipeline on Azure Pipelines.

Add a comment

Related posts:

Want to be a Penetration tester?

If you are wondering where to start, hopefully this points you in the right direction. You need a solid foundation. Once you have that, you will be able to grow. First, get used to the word “Risk”…