azure-pipelines-yaml
Azure Pipelines YAML examples, templates, and community interaction
Top Related Projects
Accelerating new GitHub Actions workflows
Quick Overview
The microsoft/azure-pipelines-yaml repository is a collection of Azure Pipelines YAML templates and examples. It serves as a resource for developers to learn and implement CI/CD pipelines using Azure DevOps, providing best practices and reusable components for various scenarios.
Pros
- Comprehensive collection of YAML templates for different use cases
- Regularly updated with new features and improvements
- Follows best practices for Azure Pipelines implementation
- Provides a starting point for developers to customize their own pipelines
Cons
- May require some Azure DevOps knowledge to fully utilize
- Some templates might be overly complex for simple projects
- Documentation could be more extensive for certain templates
- Limited to Azure Pipelines, not applicable to other CI/CD platforms
Code Examples
Here are a few examples of Azure Pipelines YAML templates from the repository:
- Basic pipeline for a .NET Core application:
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- Multi-stage pipeline for containerized application:
trigger:
- main
variables:
dockerRegistryServiceConnection: 'myDockerRegistry'
imageRepository: 'myapp'
containerRegistry: 'myregistry.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
tag: '$(Build.BuildId)'
stages:
- stage: Build
displayName: Build and push stage
jobs:
- job: Build
displayName: Build job
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- stage: Deploy
displayName: Deploy stage
dependsOn: Build
jobs:
- deployment: Deploy
displayName: Deploy job
pool:
vmImage: 'ubuntu-latest'
environment: 'production'
strategy:
runOnce:
deploy:
steps:
- task: KubernetesManifest@0
displayName: Deploy to Kubernetes cluster
inputs:
action: deploy
manifests: |
$(Pipeline.Workspace)/manifests/deployment.yml
$(Pipeline.Workspace)/manifests/service.yml
imagePullSecrets: |
$(imagePullSecret)
containers: |
$(containerRegistry)/$(imageRepository):$(tag)
Getting Started
To use these YAML templates:
- Fork or clone the microsoft/azure-pipelines-yaml repository.
- Choose a template that fits your project needs.
- Copy the YAML content to your Azure DevOps project.
- Customize the template according to your project requirements.
- Commit the YAML file to your repository (typically named
azure-pipelines.yml
). - Set up a new pipeline in Azure DevOps, pointing to your YAML file.
- Run the pipeline and monitor the results.
Competitor Comparisons
Accelerating new GitHub Actions workflows
Pros of starter-workflows
- Broader ecosystem support with workflows for various languages and platforms
- More community-driven with contributions from diverse developers
- Simpler syntax and easier to get started for newcomers
Cons of starter-workflows
- Less integrated with Azure services compared to azure-pipelines-yaml
- May require more manual configuration for complex scenarios
- Limited built-in templates for Azure-specific deployments
Code Comparison
starter-workflows (Node.js):
name: Node.js CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'
azure-pipelines-yaml (Node.js):
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
- script: npm install
Both repositories provide YAML-based workflow definitions, but starter-workflows offers a more diverse set of templates for various platforms and languages. azure-pipelines-yaml is more focused on Azure-specific scenarios and integrates better with Azure services. The syntax differs slightly, with starter-workflows using a more declarative approach, while azure-pipelines-yaml uses a task-based structure.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Azure Pipelines YAML
YAML templates, samples, and community interaction for designing Azure Pipelines.
We've consolidated issue and suggestion tracking in Developer Community. This repo will remain for working in the open on YAML pipelines, so feedback on PRs will be the primary way to use it. You might also want the docs or to open a support ticket.
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Security issues
Do you think there might be a security issue with Azure Pipelines? Have you been phished or identified a security vulnerability? Please don't report it here - let us know by sending an email to secure@microsoft.com.
Top Related Projects
Accelerating new GitHub Actions workflows
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot