DEV Community

Supraja Tangella
Supraja Tangella

Posted on

๐—จ๐—ป๐—ฑ๐—ฒ๐—ฟ๐˜€๐˜๐—ฎ๐—ป๐—ฑ๐—ถ๐—ป๐—ด ๐—ง๐—ฟ๐—ถ๐—ด๐—ด๐—ฒ๐—ฟ๐˜€ ๐—ถ๐—ป ๐—”๐˜‡๐˜‚๐—ฟ๐—ฒ ๐——๐—ฒ๐˜ƒ๐—ข๐—ฝ๐˜€ ๐—ฌ๐—”๐— ๐—Ÿ ๐—ฃ๐—ถ๐—ฝ๐—ฒ๐—น๐—ถ๐—ป๐—ฒ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—ฆ๐—ถ๐—บ๐—ฝ๐—น๐—ฒ ๐—˜๐˜…๐—ฎ๐—บ๐—ฝ๐—น๐—ฒ๐˜€

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)

โœ… ๐—–๐—ผ๐—บ๐—บ๐—ผ๐—ป ๐—ง๐˜†๐—ฝ๐—ฒ๐˜€ ๐—ผ๐—ณ ๐—ง๐—ฟ๐—ถ๐—ด๐—ด๐—ฒ๐—ฟ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—˜๐˜…๐—ฎ๐—บ๐—ฝ๐—น๐—ฒ๐˜€:

  1. ๐—–๐—œ ๐—ง๐—ฟ๐—ถ๐—ด๐—ด๐—ฒ๐—ฟ (๐—–๐—ผ๐—ป๐˜๐—ถ๐—ป๐˜‚๐—ผ๐˜‚๐˜€ ๐—œ๐—ป๐˜๐—ฒ๐—ด๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป)

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.

  1. ๐—ฃ๐—ฅ ๐—ง๐—ฟ๐—ถ๐—ด๐—ด๐—ฒ๐—ฟ (๐—ฃ๐˜‚๐—น๐—น ๐—ฅ๐—ฒ๐—พ๐˜‚๐—ฒ๐˜€๐˜)

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.

  1. ๐—ฆ๐—ฐ๐—ต๐—ฒ๐—ฑ๐˜‚๐—น๐—ฒ๐—ฑ ๐—ง๐—ฟ๐—ถ๐—ด๐—ด๐—ฒ๐—ฟ

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)