Azure DevOps Pipelines
Azure Pipelines is a cloud service that you can use to automatically build, test, and deploy your code. It works with the Git repository provider of your choice and can deploy to any cloud or on-premises server.
Key Concepts
Understanding these fundamental concepts will help you get the most out of Azure Pipelines:
- Pipelines: A set of automated jobs that run in a sequence.
- Stages: A logical grouping of jobs that represents a major phase in your pipeline, such as build, test, or deploy.
- Jobs: A collection of steps that run on an agent. A job can run on a single agent.
- Steps: A single unit of work in a pipeline, such as running a script or publishing an artifact.
- Agents: Machines that run your pipeline jobs. You can use Microsoft-hosted agents or set up your own self-hosted agents.
- Service Connections: Securely connect to external services like Azure, GitHub, or Docker Hub.
- Artifacts: Files that are produced by your build process, such as executable files, packages, or configuration files.
Getting Started
Follow these steps to create your first pipeline:
- Create a Project: If you don't have one already, create a new project in Azure DevOps.
- Connect to Your Repository: Link your pipeline to your source code repository (e.g., Azure Repos Git, GitHub).
- Configure Your Pipeline: Define your build, test, and deployment steps using YAML or the classic editor.
- Run Your Pipeline: Trigger your pipeline to execute the defined stages and jobs.
For a detailed walkthrough, see the Azure Pipelines Quickstart Guide.
YAML Pipelines
YAML is the recommended way to define your pipelines. It allows you to version your pipeline definitions alongside your application code.
Basic YAML Structure
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'
- script: |
echo Add other tasks to build, test, and deploy your code.
echo You can use predefined tasks or write custom scripts.
displayName: 'Another script'
Classic Editor Pipelines
The classic editor provides a visual interface for building and managing your pipelines. It's a good option for simpler scenarios or when you're new to pipelines.
Learn more about the Classic Editor.
Common Scenarios
- Continuous Integration (CI): Automatically build and test code whenever changes are pushed to the repository.
- Continuous Deployment (CD): Automatically deploy your application to various environments after a successful build.
- Multi-stage Pipelines: Orchestrate complex deployment processes across multiple environments (Dev, Test, Staging, Production).
- Containerization: Build and deploy Docker images to container registries like Azure Container Registry.