azure-devopscronyamlazure-pipelines

Yaml pipeline sheduled crons not working as expected


I have this yaml pipeline:

trigger:
  - none

schedules:
- cron: '0 20 * * Mon-Fri'
  displayName: Weekday
  branches:
    include:
    - main
  always: true

- cron: '0 8 * * Sat-Sun'
  displayName: Weekend
  branches:
    include:
    - main
  always: true

Microsoft states that this is possible on one of it's examples: microsoft yaml example

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/scheduled-triggers?view=azure-devops&tabs=yaml

But instead of working as intended (ones schedule triggering on weekdays and the other only on weekend) I get both triggering every day.

I'am doing something wrong, is it maybe not supported but microsoft docs are outdated, any clue? Thanks!


Solution

  • Based on the current cron syntax in your YAML pipeline, here were the schedule runs captured at 05:10.00 UTC, where we could see the Weekday schedule should be triggered as expected, while the Weekend schedule didn't.

    Image

    As I tested to modify the Weekend schedule with the expression of cron: '0 8 * * Sat,Sun', the scheduled runs became those in the image below.

    Image

    You may check if the modification works for you. Besides, you mentioned that both your Weekend and Weekday schedules triggered the pipeline every day, but I didn't see the issue should exist in the Weekday schedule. In case, the Weekday schedule didn't work as expected, either, I would suggest you follow the FAQ and first double check if you have defined schedules in the Web UI that overrides the YAML trigger settings.