Overview
In this lab, you will learn how to configure continuous integration (CI) and continuous deployment (CD) for your applications using Build and Release in Azure Pipelines. This scriptable CI/CD system is both web-based and cross-platform, while also providing a modern interface for visualizing sophisticated workflows. Although we won’t demonstrate all of the cross-platform possibilities in this lab, it is important to point out that you can also build for iOS, Android, Java (using Ant, Maven, or Gradle) and Linux.
Prerequisites
- This lab requires you to complete task 1 from the prerequisite instructions.
Exercise 1: Introduction to Azure DevOps Build
Task 1: Creating a basic build pipeline from a template
-
Navigate to your team project on Azure DevOps.
-
Navigate to Pipelines | Pipelines.
-
Open (click) the existing PartsUnlimitedE2E pipeline (which was created by the demo generator tool) and click on Edit
-
Not to have two pipelines triggered later in the lab, disable the CI trigger for the template created pipeline (uncheck) and Save.
-
Navigate back to Pipelines | Pipelines and click New pipeline to create a new build pipeline.
-
The default option for build pipelines involves using YAML to define the process. If you are interested in that, please check out that lab. For this lab, click use the classic editor.
-
The first thing you’ll need to do is to configure the source repository. Every major platform is available, but the default options are all we need here. This build will use the master branch of the PartsUnlimited repo. Leave the defaults and click Continue.
-
Locate the ASP.NET template and click Apply to apply this template to the build definition. Note that there are many options that should cover all of our mainstream scenarios. For our purposes here, we’ll just build the project using the baseline ASP.NET template.
-
The process for this build pipeline is easy to follow. After getting the source, Azure DevOps will use NuGet to restore any dependent packages. Then, the project will be built and tested. The results will then be published to the configured target.
-
Select the Variables tab. Here you can configure special parameters to be used during the build, such as the configuration or platform.
-
Select the Triggers tab. These triggers enable you to automatically invoke builds on a schedule, when another build completes, or when changes are made to the source. Check Enable continuous integration so that this build will get invoked whenever source changes are committed.
-
Select the Options tab. This section includes a wide variety of options related to the build workflow. Note that you’ll generally configure options for specific build tasks on the configuration views of the tasks themselves.
-
Select the History tab. There’s nothing here yet, but it will show a history of changes you make to the build definition.
-
Select Save & Queue | Save & Queue to save and queue a new build.
-
Accept the default options by clicking Save and run.
Task 2: Tracking and reviewing a build
-
Depending on load, the build may need to wait in the queue for a moment.
-
Once the build begins, you’ll be able to track the console output per task. Click Agent job 1.
-
If you want to review an earlier task, you can scroll the right pane to review its logs.
-
The build should eventually succeed. You can return to the summary view by clicking the back button.
-
The summary view provides overview details about the build, including details about commits, tests, and artifacts.
-
Select the Tests tab to review test performance for this build. Note that you also have easy access to the pipeline editor, the ability to queue a new build, and download the artifacts of this build.
Task 3: Invoking a continuous integration build
-
The build was configured earlier to support continuous integration. Navigate to the code for this project using Repos | Files.
-
Open the file at PartsUnlimited-aspnet45/src/PartsUnlimitedWebsite/Views/Home/Index.cshtml.
-
Click Edit.
-
Make a minor cosmetic change, such as by tweaking the title of the document. Click Commit.
-
Accept the default commit details and click Commit.
-
A build should be underway shortly. Select Pipelines | Pipelines to see if it’s in progress.
-
You should now see that a new build (note the .2) is in progress and that it was triggered by your change. Click the build to track it. Note that it may be queued behind another build pipeline configured for continuous integration.
-
This build should run and succeed just like the previous build.