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
mainbranch.
- 𝗣𝗥 𝗧𝗿𝗶𝗴𝗴𝗲𝗿 (𝗣𝘂𝗹𝗹 𝗥𝗲𝗾𝘂𝗲𝘀𝘁)
Runs pipeline when a pull request is created or updated.
pr:
branches:
include:
- develop
This runs when a PR is opened into the
developbranch.
- 𝗦𝗰𝗵𝗲𝗱𝘂𝗹𝗲𝗱 𝗧𝗿𝗶𝗴𝗴𝗲𝗿
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)