top of page
Search
  • Nathan

Azure DevOps YAML Pipelines - Part 1

Updated: Jan 15

The Basics


There are a lot of topics to cover for YAML-based Pipelines in Azure DevOps. So, I will be breaking this up into a multi-part series. This section will be updated over time with links to the whole series of articles once they are written.

 

Types of Pipelines in Azure DevOps


Azure DevOps Pipelines currently come in 2 different varieties:

  1. 'Classic' Pipelines that are created by clicking through the graphical user interface of Azure DevOps. These come in both Build and Release formats.

  2. YAML Pipelines that are written completely in code and stored in a version control system such as GitHub or Azure Repos Git. These Pipelines use different types of jobs, including build jobs and deployments jobs.

This series of articles will focus solely on the newer YAML-based Pipelines. I won't say much, if anything at all, about the old graphical Pipelines. After all, they are called 'classic' for a reason.

 

Your First YAML Pipeline


First, we need to create a Pipeline inside Azure DevOps.

  1. Login to your Azure DevOps Organization (dev.azure.com)

  2. Select your Azure DevOps Project

  3. Go to the Pipelines section of your Project

  4. (The details of Azure DevOps Organizations and Projects are outside of the scope of this series)

  5. Finally, click on the 'New pipeline' button in the upper-right corner, and you will see the screenshot below

As shown in the screenshot above, you will be asked to select which type of Version Control System will be used to hold your YAML file. YAML Pipelines only work with a handful of different Version Control Systems. The currently supported list is:

  • Azure Repos Git

  • GitHub

  • GitHub Enterprise Server

  • Bitbucket Cloud

You may see other options listed, but if you pick those options you will be creating a 'Classic' Pipeline, which is not what we want.


If you pick one of the GitHub options or Bitbucket Cloud, then Azure DevOps will need need to know how to authenticate to those services. Azure DevOps makes this easy and will walk you through the process of signing into those services and configuring the proper access. Once access is configured, Azure DevOps will store that information in what is called a Service Connection, which can be found under the settings for your Azure DevOps Project.


Once access is squared away you will be presented with two basic options, as shown in the screenshot below.

The first option is Starter pipeline. This will take you to a web editor that will be pre-populated with some basic YAML Pipeline code. In the upper-right corner, you will see a button that says 'Save and run'. There's no need to run this pipeline right now. So, you can click on the dropdown and select 'Save' instead. This will do 2 things:'

  1. It will save the YAML file to your Repo

  2. It will create the new Pipeline inside Azure DevOps


The second option is Existing Azure Pipeline YAML file. Clicking this will ask you to select an existing YAML file from your Repo. Once you select a YAML file, this will take you to a web editor. But, this time it will be pre-populated with the code from your existing YAML file, if there is any. Note: your YAML file needs to exist already, but it doesn't need to have any code yet. In the upper-right corner, you will see a button that says 'Run'. There's no need to run this pipeline right now. So, you can click on the dropdown and select 'Save' instead. This will create the new Pipeline inside Azure DevOps.


At this point, if everything worked correctly, you should have a new Pipeline configured in Azure DevOps which is connected to a YAML file stored in a Version Control System. The YAML file could have some sample code, it could have your own code, or it could even be empty. The contents of the YAML file aren't important right now. They only matter when we attempt to run our Pipeline, and we're not at that point yet.

 

Organizing your Pipelines

As shown in the screenshot above, the default view for Pipelines is the Recent tab. This tab only shows a list of Pipelines that have recently run. It does NOT show all of your Pipelines. For example, new Pipelines that have not been run yet will not show up on this tab.


To see all of your Pipelines click on the All tab, instead. The All tab will show you every pipeline you have, regardless of when it was last run. A nice feature of the All tab is that you can optionally create folders, and move your Pipelines to them, in order to help you organize your Pipelines better.

 

To summarize, you should now be able to create and organize your YAML Pipelines in the Azure DevOps UI.


Next up, we'll be going over the high-level structure of a YAML Pipeline.

Part 2 - Structure of a YAML Pipeline

 

References

59 views
bottom of page