Reputation: 25
Is there a way to customize the pipeline scheduling options in Azure to have it run only the second week of each month?
I know you can schedule it to run on individual days of the week, but I cannot figure out how I would do this on a monthly scale.
Upvotes: 2
Views: 10461
Reputation: 3058
Can I do this if my pipeline was made as a classic/GUI based, and not as a YAML pipeline?
In the classic pipelines, you can only set scheduled triggers for each week. As far as I know, you can not have it run only the second week of each month in the classic pipelines. However, you can set schedule triggers in yaml pipeline and use it to trigger your classic pipeline.
Here is the sample if you are going to use a YAML pipeline:
schedules:
- cron: "0 0 8-14 * *"
displayName: schedule
branches:
include:
- main
always: true
In this example:
always: true
means run even when there are no code changes.Please find more detailed information about Configure schedules for pipelines in the document.
Upvotes: 5
Reputation: 2856
You can achive this by creating a scheduling trigger in your YAML config. Note tough, you must disabled PR and CI triggers to run your pipeline by using scheduled triggers.
You disable the trigger by setting pr: none
and trigger: none
. Then you define the schedule using cron syntax.
schedules:
- cron: "0 0 1/14 * *" # At 00:00 on every 14th day-of-month from 1 through 31.
displayName: Second week of each month
branches:
include:
- master
...
https://github.com/atifaziz/NCrontab/wiki/Crontab-Expression
Upvotes: 1
Reputation: 603
It doesn't seem to do so in the UI, but you can still trigger the build via an API call on your own schedule. https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/queue?view=azure-devops-rest-6.1
Upvotes: 0