Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
964 views
in Technique[技术] by (71.8m points)

cron - 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.

question from:https://stackoverflow.com/questions/66047621/azure-pipelines-schedule-to-run-only-few-days-a-month

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...