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:
'Classic' Pipelines that are created by clicking through the graphical user interface of Azure DevOps. These come in both Build and Release formats.
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.
Login to your Azure DevOps Organization (dev.azure.com)
Select your Azure DevOps Project
Go to the Pipelines section of your Project
(The details of Azure DevOps Organizations and Projects are outside of the scope of this series)
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 Enterprise Server
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 it 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 into 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. If you choose this it 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:
It will save the YAML file to your Repo
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, it 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 necessarily 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. Depending on your situation, the YAML file could have some sample code, it could have your own code, or it could even be empty. It doesn't matter, as 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. 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.