Search code examples
azure-devopscronazure-pipelines

Azure Pipelines Schedule to Run Only Few Days a Month


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.


Solution

  • 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:

    • 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: enter image description hereenter image description here

    Please find more detailed information about Configure schedules for pipelines in the document.