Part 2-Pipeline: "Classic Editor CI/CD Walkthrough"
Tags: azure, cicd, devops, beginners
Published: 2023-12-19 04:00:00

Welcome to Part 2 of our series, 'Classic Editor CI/CD Walkthrough.' Following the successful launch of our web app using Azure Web App Service in the previous part, we'll now delve into creating a classic editor pipeline. Get ready to build our first job in Azure DevOps as we explore the intricacies of the classic editor in this installment.

=================================================================

*Note: *

When you are doing practical work, don't delete anything because our Azure DevOps series relies on continuity between each part. Ensure that you are not cleaning your workspace. Additionally, don't worry about charges, as our account is on a free trial. We are covering beginners or basic Azure DevOps, so our project is not large. If a bill is generated, it will not go higher. For some knowledge, you can budget or be ready to invest some money.

=================================================================

-> So, let's get started.

-> Now, navigate to 'Azure DevOps' and enter the 'Pipeline' section. Our first step is to create a build pipeline, so click on 'Create Pipeline'.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vtcmcmzyeofq8re6qzb8.png)

-> After clicking on 'Create Pipeline,' you'll be presented with various options for building pipelines. For our initial steps, let's opt for the 'Classic Editor' as mentioned earlier.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/smzbdwhndmncnuiy18if.png)

-> Keep the options as default, and ensure you've selected the correct one, as shown below, then proceed by clicking 'Continue.'

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6jhh00iobxuzf07gk1fo.png)

-> Skip the template selection and choose 'Empty Job' on the next window, as we want to customize our steps.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8j2bk519bllcwzl3yccu.png)

-> Provide a name for the pipeline and choose an agent pool. The agent pool represents the underlying infrastructure where your code will be built. Also, select the operating system for the build.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pbkq5d11yjwulgy9dbq0.png)

-> In the 'Get Sources' step, the pipeline will fetch or download your application code or pipeline code (YAML). Keep the options as the default settings.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a2sho4upuywp4mmi6d2y.png)

-> After checking out the code, the next step is to run the application on the agent. You can select the agent at different levels such as build, test, or deploy. Click on the '+' sign to add additional steps.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mr8kbahz9j3uxxmohnc6.png)

-> After opening it, search for 'npm' because, after checking out, our first step is to run 'npm install'. After searching, click on 'Add'.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d1q4ikil4rdw0co1m6c5.png)

-> After 'npm install', the next step will be 'npm build'. For that, click on the '+' button again, search for 'npm', and add it.

-> After clicking on 'npm', another window will open where you need to define the command to run. Select 'Custom' as the command, and the command & argument should be 'run build'.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8jxxxwx7pmgilwrzb8q8.png)

-> Now, for the next step, which is publishing the build for use in the release pipeline or later stages, click on '+', and search for 'Publish Artifact: drop'.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/quhflc4lmnbmpixs759j.png)

-> If you notice, I added '/build' in the location because in Node.js, after building the code, it is stored in the 'Build' folder by default. Keep the other options as default.

-> Now, the next step is the 'Application Deployment.' Within this step, we will create the entire CI/CD pipeline, and later on, we will also create a release pipeline.

-> Now, click again on “+” and search for 'Azure App Service Deploy.' Inside it, select 'Azure subscription.' When your 'Azure Portal' is connected to 'Azure DevOps,' it requires a service connection for authentication. This authentication is provided by a service principal, which is an entity with specific permissions. You create a service principal in the Azure Portal, assign some permissions to it, and then use that service principal to create the service connection in Azure DevOps.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v0pf8u8koe364yzmyrwc.png)

-> Now, during the configuration of the subscription, it will ask to authorize the service connection. Click on 'Authorize,' and a window will appear asking for your Microsoft ID. Log in with the same email used for Azure Portal. After authorizing, the error will be resolved.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/suz7tw5gbnhpf1h6qx7u.png)

-> Next, in 'App Service type,' select 'Web app on Linux.' Follow the instructions in the image below for further configuration.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/546xv436cqg7ptuu2tjs.png)

-> And that concludes the job configuration. We've successfully created the pipeline, added various stages, and defined tasks within those stages. Additionally, in the 'Variables' tab, you'll find the 'Debug log' option, which can be set to 'true' for more detailed logs during pipeline execution. However, I haven't enabled it. Don't forget to 'Save & Queue' the pipeline, saving your changes and triggering its execution.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cuedxntn42jmfi584ykl.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2j7sxeziv87kz16u7n8l.png)

-> After saving and queuing the pipeline, you'll see it in the pipeline list. Click on 'Agent 1' to view the logs and monitor the execution progress.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ppiud5a1ctyzqfs3ozfm.png)

-> Now, you can observe that our pipeline has successfully completed.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xjddfbnao912bywreeq2.png)

=================================================================

Summary:

In conclusion, we successfully explored and implemented a classic editor pipeline in Azure DevOps. We created a custom pipeline with various stages and tasks, incorporating key steps such as npm install, npm build, and publishing artifacts. The pipeline was configured to deploy a Node.js application to an Azure App Service. With each step explained in detail, we now have a foundational understanding of CI/CD processes using Azure DevOps.

=================================================================

If you have any doubts, questions, or recommendations, feel free to drop a comment. Follow me for updates and happy learning! :)