Dear all, in my ci I would like to trigger jobs at a differente date. To do so, in the cicd schedule section I create 4 different schedule; For some reasion the cron expressions I use are misinterpreted; You can find them below and test them under: https://crontab.cronhub.io/ or any website you like.
In gitlab the schdule for the 1st monday of the month will be execute in 4 days ; Iβm confused as we are today the 18th of Octover.
To reproduce this behaviour, you can:
- create a new schedule in one of your repo under: build > pipeline_schedules
- you can copy past one of the cron expression below and choose your time_zone
- add a description (name of your schedule)
- select activated
I obviously miss something; Could you please point me to the good direction here ?
Thanks inadvance for your time and help on this subject.
# ## 1st_monday_of_the_month -- 0 2 1-7 * 1 -- "At 02:00 on every day-of-month from 1 through 7 and on Monday."
# ## 2nd_monday_of_the_month -- 0 2 8-15 * 1 -- "At 02:00 on every day-of-month from 8 through 15 and on Monday."
# ## 3rd_monday_of_the_month -- 0 2 16-23 * 1 -- "At 02:00 on every day-of-month from 16 through 23 and on Monday."
# ## 4th_monday_of_the_month -- 0 2 24-31 * 1 -- "At 02:00 on every day-of-month from 24 through 31 and on Monday."
As gitlab-ci you can use something like this:
workflow:
rules:
- if: $CI_COMMIT_BRANCH != "main" && $CI_PIPELINE_SOURCE != "merge_request_event"
when: never
- when: always
stages:
- Test
- UpgradeSystem
variables:
Prechecks:
stage: Test
script:
- echo "check server availability"
job1-upgrade-linux-system-only-DC1:
stage: UpgradeSystem
only:
- 1st_monday_of_the_month # see schedules section for details
script:
- echo "upgrade os on dc1"
job2-upgrade-linux-system-only-DC2:
stage: UpgradeSystem
only:
- 2nd_monday_of_the_month # see schedules section for details
script:
- echo "upgrade os on dc2"