What is YAML Pipeline in Azure DevOps: Explained Simply
YAML pipeline in Azure DevOps is a way to define your build and release process using a simple text file written in YAML format. It automates tasks like compiling code, running tests, and deploying apps by describing steps in a clear, reusable file stored with your code.How It Works
Think of a YAML pipeline as a recipe for baking a cake. Instead of writing the recipe on paper, you write it in a special language called YAML that computers understand. This recipe tells Azure DevOps exactly what steps to follow to build and deliver your software.
When you save this YAML file in your project, Azure DevOps reads it and performs each step automatically. This can include compiling your code, running tests to check for errors, and sending the finished product to users. Because the recipe is text-based and stored with your code, it’s easy to update, share, and track changes over time.
Example
This example shows a simple YAML pipeline that builds a .NET project and runs tests.
trigger: - main pool: vmImage: 'ubuntu-latest' steps: - task: UseDotNet@2 inputs: packageType: 'sdk' version: '7.x' - script: dotnet build --configuration Release displayName: 'Build project' - script: dotnet test --no-build --verbosity normal displayName: 'Run tests'
When to Use
Use YAML pipelines when you want a clear, version-controlled way to automate your software builds and deployments. They are great for teams that want to keep their automation scripts close to their code and track changes easily.
Common use cases include continuous integration (CI) where code is built and tested automatically on every change, and continuous delivery (CD) where the software is deployed to testing or production environments without manual steps.
Key Points
- YAML pipelines are text files stored with your code for easy version control.
- They automate building, testing, and deploying software.
- They run automatically when you push code changes.
- They make automation clear, repeatable, and easy to update.