we start our nightly build by creating a ‘schedule’ in CI/CD => Schedules, configure them with cron pattern, some variables etc. Within our .gitlab-ci.yml we configure some jobs with
only: schedules in order to start such a job ONLY if it was started by the scheduler OR if we manually click the play button.
Now, only becomes deprecated and we should use the new
rules keyword. We define some rules in order to decide, which deployment we start for the given scheduled task. we use
deploy-1-nightly: stage: deploy rules: - if: '$PROFILE == "1-nightly"' when: always deploy-2-nightly: stage: deploy rules: - if: '$PROFILE == "2-nightly"' when: always
But both jobs are now executed on each build, not only for those scheduled builds !
How can we combine the new
rules with the previously uses
only:schedules in order to start such a job on scheduled (or clicked play button) only ?