最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to trigger Azure DevOps Classic release pipelines monthly? - Stack Overflow

programmeradmin4浏览0评论

I Have Azure DevOps Classic Release pipeline as follows and it has a scheduled trigger:

The tasks look like this:

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.

I Have Azure DevOps Classic Release pipeline as follows and it has a scheduled trigger:

The tasks look like this:

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.

Share Improve this question asked Mar 14 at 15:36 user9513505user9513505 471 gold badge2 silver badges7 bronze badges 1
  • 1 For a pipeline that simple, what's preventing you from converting it to YAML and using a cron trigger? Converting it would probably take less time than it took you to write this post and take screenshots. – Daniel Mann Commented Mar 16 at 4:54
Add a comment  | 

2 Answers 2

Reset to default 1

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.

  1. 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:
          - "*"
    
  2. 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.

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:

  • The pipeline will be triggered from the 8th to the 14th of this month. You need to update the date each month.

  • always: true means run even when there are no code changes.

  • Agree with iikkoo that if you want to run your pipeline by only using scheduled triggers, you must disable PR and continuous integration triggers by specifying pr: none and trigger: none in your YAML file.

  • You can add a build completion trigger in this yaml pipeline to trigger your classic pipeline: Please find more detailed information about Configure schedules for pipelines in the document.

发布评论

评论列表(0)

  1. 暂无评论