I have a little testing project that I will need to compile and build every 2 weeks specifically on a Saturday.
according to Microsoft Azure documentation I can use the schedules
and set my cron, so I did as follow:
trigger : none
schedules:
- cron: '* 8 1/14 * 6'
displayName: Trigger every 2nd and 4th Saturday
branches:
include:
- test
always: true
But this is not working as I expected as in the Azure devOps I couldn't see the triggers.
Basically what I would like is for each month, this pipeline need to trigger on the 2nd Saturday and the fourth Saturday of the month (every 2 weeks on a Saturday).
As far as I understand from the documentations, is hard to set the days if they are not in a weekly basis, so tried with the hours. To test this I used crontab guru. Basically I counted how many hours there are in 14 days and set the cron as follow:
trigger : none
schedules:
- cron: '* 8/312 * * *'
displayName: Trigger every 2nd and 4th Saturday
branches:
include:
- test
always: true
But this for some reason it shows that the next trigger will be tomorrow at 8 in the morning.
I am quite confused at this point.
Did anyone have any advice how I can guarantee that the trigger will always falls on a Saturday every 2 weeks please?
Please, if my issue is not 100% clear, do not hesitate to ask more details.
Thank you so so much for any help you can provide me with.
I believe you would want the following cron job
cron: 0 8 8-14,22-28 * 6
The logic behind this is the 2nd Saturday of the month must fall between days 8-14 and likewise the 4th Saturday to be between 22-28. You can test this by clicking the 3 dots on the pipeline and checking Schedule Runs. The problem with this is it only shows schedule runs within the next week so you would have to wait a while to confirm it works.
As a quick test to check the scheduling, if you use the above but modify it to run on a Wednesday ( as we are already past the 4th Saturday in this month) you can see that it will trigger once this week on the 28th