0

I'm trying to create a pipeline in Azure DevOps that would trigger every every 2nd and 4th Tuesday of the month regardless if there are changes on the git branches. This is what I have, but it's not working.

trigger: none
pr: none

schedules:
 cron: '0 8 8-14,22-28 * 2'
 displayName: Trigger every 2nd and 4th Tuesday
 branches:
     include: 
     - develop
  always: true

It is working for this - cron: "*/5 * * * *"(triggering every 5 mintues) but above cron is not working.

Tej
  • 41
  • 1
  • 6
  • Not sure if intentional, but the `always:true` isn't indented properly in the codeblock above. – jessehouwing Aug 09 '23 at 09:01
  • Maybe this example can help: https://stackoverflow.com/a/33816674. At least it shows a different syntax on how to select second and/or fourth day of a month. So for the second tuesday it would be "2#2", for the fourth it would be "2#4". – rekcul Aug 09 '23 at 09:18

2 Answers2

0

This is not possible with just cron expression in Azure DevOps. This implementation doesn't support this

enter image description here

Take a look on issue here.

What you can do is to run every Monday and Tuesday and then in first job check if this is a 2nd or 4th. Based on that set variable and use that variable in condition to run or not a real job.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
0

This cron works for me

  - cron: 0 8 6-12,20-26  * 2
Tej
  • 41
  • 1
  • 6
  • Thank you for contributing to the Stack Overflow community. This may be a correct answer, but it’d be really useful to provide additional explanation of your code so developers can understand your reasoning. This is especially useful for new developers who aren’t as familiar with the syntax or struggling to understand the concepts. **Would you kindly [edit] your answer to include additional details for the benefit of the community?** – Jeremy Caney Aug 25 '23 at 02:49