Today I learned how ๐๐ฟ๐ถ๐ด๐ด๐ฒ๐ฟ๐ work in Azure DevOps YAML pipelines and how they help automate CI/CD.
โ ๐ช๐ต๐ฎ๐ ๐ถ๐ ๐ฎ ๐ง๐ฟ๐ถ๐ด๐ด๐ฒ๐ฟ?
A ๐๐ฟ๐ถ๐ด๐ด๐ฒ๐ฟ defines the event that starts the pipeline automatically.
For example:
- Pushing code to a branch
- Creating a pull request
- Running on a schedule (like daily at 2 AM)
โ ๐๐ผ๐บ๐บ๐ผ๐ป ๐ง๐๐ฝ๐ฒ๐ ๐ผ๐ณ ๐ง๐ฟ๐ถ๐ด๐ด๐ฒ๐ฟ๐ ๐๐ถ๐๐ต ๐๐ ๐ฎ๐บ๐ฝ๐น๐ฒ๐:
- ๐๐ ๐ง๐ฟ๐ถ๐ด๐ด๐ฒ๐ฟ (๐๐ผ๐ป๐๐ถ๐ป๐๐ผ๐๐ ๐๐ป๐๐ฒ๐ด๐ฟ๐ฎ๐๐ถ๐ผ๐ป)
Runs pipeline automatically when code is pushed to a specific branch.
trigger:
branches:
include:
- main
This runs the pipeline when you push changes to the
main
branch.
- ๐ฃ๐ฅ ๐ง๐ฟ๐ถ๐ด๐ด๐ฒ๐ฟ (๐ฃ๐๐น๐น ๐ฅ๐ฒ๐พ๐๐ฒ๐๐)
Runs pipeline when a pull request is created or updated.
pr:
branches:
include:
- develop
This runs when a PR is opened into the
develop
branch.
- ๐ฆ๐ฐ๐ต๐ฒ๐ฑ๐๐น๐ฒ๐ฑ ๐ง๐ฟ๐ถ๐ด๐ด๐ฒ๐ฟ
Runs pipeline at a specific time.
schedules:
- cron: "0 2 * * *" # Runs daily at 2 AM UTC displayName: Daily Build branches: include: - main always: true
This ensures your pipeline runs even if no code was pushed that day.
โ ๐๐ผ๐ ๐๐ผ๐ฒ๐ ๐ฎ ๐ง๐ฟ๐ถ๐ด๐ด๐ฒ๐ฟ ๐ช๐ผ๐ฟ๐ธ?
- Once the YAML file is added to your repo with a valid
trigger
, - Azure DevOps listens for that event (push, PR, or time),
- When the event happens, ๐๐ต๐ฒ ๐ฝ๐ถ๐ฝ๐ฒ๐น๐ถ๐ป๐ฒ ๐ฟ๐๐ป๐ ๐ฎ๐๐๐ผ๐บ๐ฎ๐๐ถ๐ฐ๐ฎ๐น๐น๐.
๐ช๐ต๐ฎ๐ ๐๐ฟ๐ถ๐ด๐ด๐ฒ๐ฟ ๐๐๐ฝ๐ฒ๐ ๐ต๐ฎ๐๐ฒ ๐๐ผ๐ ๐๐๐ฒ๐ฑ ๐ถ๐ป ๐๐ผ๐๐ฟ ๐๐๐๐ฟ๐ฒ ๐๐ฒ๐๐ข๐ฝ๐ ๐ฝ๐ถ๐ฝ๐ฒ๐น๐ถ๐ป๐ฒ๐? ๐๐ถ๐ฑ ๐๐ผ๐ ๐ณ๐ฎ๐ฐ๐ฒ ๐ฎ๐ป๐ ๐ถ๐๐๐๐ฒ๐ ๐๐ต๐ถ๐น๐ฒ ๐ฐ๐ผ๐ป๐ณ๐ถ๐ด๐๐ฟ๐ถ๐ป๐ด ๐๐ต๐ฒ๐บ?
Top comments (0)