I Have Azure DevOps Classic Release pipeline as follows and it has a scheduled trigger:
Instead of using the default trigger (which just allows triggering weekly), I want to trigger it each 30 days. What is the easy way to trigger these classic release pipelines each month?
I have CI/CD pipeline, it's mainly for build/test, I do not want to use that for this case. This is separate. I am just searching for a way, or adding a task that will trigger this release pipelines.
Thanks in advance for your suggestions.
Currently, Azure DevOps classic release pipeline doesn't support schedule trigger every month. For an easy workaround, agree with @damilola onadeinde, you can create a YAML pipeline triggered monthly and use it to trigger your classic release pipeline.
If you want to trigger your pipeline on a fixed date every month, you can refer to the following method.
For example, trigger the pipeline at 0:00 AM (UTC) on the 1st of every month.
YAML file
trigger:
- none
schedules:
- cron: '0 0 1 * *'
displayName: 'Runs every 1st of the month'
always: true
branches:
include:
- "*"
pool:
vmImage: ubuntu-latest
steps:
- script: echo Trigger release every month!
displayName: 'Trigger release every month'
Or, trigger the pipeline on the second Sunday of every month.
trigger:
- none
schedules:
- cron: '0 0 8-14 * */7'
displayName: 'Runs on the second Sunday of every month'
always: true
branches:
include:
- "*"
Add the YAML pipeline as the artifact of your classic pipeline and enable CD trigger for your release pipeline.
If you want more complex trigger conditions or the default schedule trigger does not meet your needs, you need to combine it with scripts. For example, if the interval between each release pipeline trigger is 30 days, you need to set an approximate schedule time in advance, and then check in the scripts whether the interval between the last release pipeline trigger and today is 30 days. If so, set the current build status to success, otherwise set it to failed, and the release will not be triggered.