I have composed a gitlab-ci.yml file consisting of multiple gitlab jobs and stages. Some jobs run on specific git branches when code is merged to that branch and some jobs are scheduled.
I want to create a scheduled CI/CD pipeline in Gitlab which only contains specific scheduled jobs and not all the scheduled jobs. Is that possible?
For Example this is my gitlab-ci.yml file.
stages:
build
test
deploy
scheduled-test-1
scheduled-test-2
scheduled-test-3
build:
script:
- echo $Service_Version
only:
- develop
except:
- schedules
test:
script:
- echo $Service_Version
only:
- develop
except:
- schedules
deploy:
script:
- echo $Service_Version
only:
- develop
except:
- schedules
scheduled-test-1:
script:
- echo $Service_Version
only:
- schedules
scheduled-test-2:
script:
- echo $Service_Version
only:
- schedules
scheduled-test-3:
script:
- echo $Service_Version
only:
- schedules
Now, when I create a schedule then all the three schedule tests are seen on the pipeline. I want to create three schedules which has scheduled-test-1, scheduled-test-2 and scheduled-test-3 separately. How is that possible?
CodePudding user response:
Use only:variables:
and set those variables in your schedules.