Problem with scheduler

Hi,

My goal is to create CI/CD scheduler that will run Android UI tests nightly and only on DEV branch, and also not to run those tests on any other even besides PLAY button in the CI/CD Scheduler screen. After looking at https://docs.gitlab.com/ee/ci/yaml/README.html#onlyexcept-advanced I have made the following YAML configuration:

schedule_ui_tests:
stage: UITests
tags:
- android
script:
- fastlane androidTest
only:
- schedules AND dev

The idea is to make this job run on schedule only and on the branch named DEV. But… with this configuration, I wasn’t able to run this job manually with the play button from the CI/CD Schedulers screen. GitLab is showing a notification that the job is placed in the queue of the Pipeline, but the job wasn’t placed there. Oddly enough if I add -branches at the only: the PLAY button works but so does the job is triggered for git push, and on merge requests and so on.

Do you have any suggestions on what to do next with this job configuration?

Thank you for your time.

I have solved the problem. What was missing was keyword refs:

only:
refs:
- schedules

With this everything worked as expected. Tests are running on PLAY button, and they are triggered by the scheduler.

There is also another solution, and that is to add a variable to the scheduler definition and than intercept it in the job configuration like so:

only:
variables:
- $SCHEDULE == “TRUE”

It is assumed that variable is called SCHEDULE and it has value TRUE.