Bi-weekly pipeline schedule

CI/CD Pipeline scheduling cron works incorrectly

*When setting a bi-weekly cron schedule (i.e. 15 0 /14 * 1) it does not use cron’s specifications correctly

  • Let’s say both of these cron schedules don’t work as expected (every two weeks on Monday at 00:05am)
5 0 */14 * 1
5 0 8-14,22-28 * 1
  • The first schedule in 2021 April was scheduled “today” (though today is NOT Monday)

  • Next schedule is for April 5th (though it does not match days 8-14,22-28)

  • What version are you on? Are you using self-managed or GitLab.com?

    • On premisses GitLab 13.5.5-ee
  • The main issue, that fugit cron combines elements 1-4 and ignores 5th, or combines 1,2,5 and ignores 3rd/4th, which results in unpredictable results

Does anyone know how to fix it?

It happened again on 1st of May, and again on 3rd, - though it supposed to run on 10th of May

An interesting snippet of documentation from the fugit project

There is a surprising thing about this canon, all the columns are joined by ANDs, except for monthday and weekday which are joined together by OR if they are both set (they are not * ).

They go on to state that the way to handle this is either by the hash extension or the modulo extension

Any updates? I am having the same problem

At the moment the solutions we are using to have bi-weekly schedules is to define a weekly schedule and inside the job we are checking if the week is even or odd in order to decide to continue executing the job or not.
This works until 2027 :sweat_smile: when weeks will be 53 instead of 52. Obviously, this is not the best solution but at least, at the moment, it works for us.