Issue
I'm trying to get a cron schedule running by using yaml instead of azure pipeline scheduling.
This is my YAML:
trigger: none
pr: none
schedules:
- cron: "0 0 * * *"
displayName: Daily midnight build when changes have been pushed
always: true
branches:
include:
- branch1
- branch2
variables:
- group: BranchVariables
First it ran every time someone made a PR, figured out that I've to add "pr: none". Now I don't know what is missing. What am I potentially missing? The ms documentation is sparsely and I already read all the related topics on this issue.
Thanks in advance!
Update:
When I want to check the schedules on the pipeline it doesn't show me any and I can't sync
When I edit the pipeline I get the current yaml version on master branch we do not use anymore and is not the default branch. The pipeline should only run for the two branches I include in the yaml branches property.
The pipeline still didn't run this night and my guess was now that the yaml with the schedules must be also checked into the master branch. I figured out that the default branch can be set for every pipeline and I changed it now and finally can sync and see the schedules. What's still mysterious to me is that I had to add the default pipeline branch to the included branches before the schedules showed up. I'm now using only one included branch.
Solution
All seems fine to be with your pipeline. I tested it with this code:
trigger: none
pr: none
schedules:
- cron: "0 0 * * *"
displayName: Daily midnight build when changes have been pushed
always: true
branches:
include:
- branch1
- branch2
- master
variables:
- group: BranchVariables
steps:
- script: echo "hello $(test)"
Please keep in mind that you have filter for specific branches, so make sure that branch1 or branch2 exists.
I created a new branch branch1
and changed to default branch for the pipeline and ten synced schedules:
Answered By - Krzysztof Madej Answer Checked By - David Marino (WPSolving Volunteer)