Reputation: 578
I'm trying to migrate some old Jenkins stuff to Gitlab CI/CD. I got the CI/CD part sorted out, that works fine - but I have a couple of "odd jobs" that do stuff like "mirror the production database to the staging environment", "mirror production user uploaded assets to staging" and the likes.
How do I express this in Gitlab CI syntax? when:manual
jobs don't (really) cut it as the "odd jobs" are totally independent of any pipelines and are needed maybe once a half year tops?
Upvotes: 0
Views: 1155
Reputation: 1435
create a separate repo and put all of your odd jobs there, after this, for each one, create a template file to be used on demand. Check the docs https://docs.gitlab.com/ee/ci/yaml/#include
In your pipeline use only/except filters to load these templates https://docs.gitlab.com/ee/ci/yaml/#onlyexcept-advanced
You will be able to handle the behaviour of your pipeline for example
If commit message contains [mirror-db] load the template mirror-db.yml from odd-jobs repository
include:
- project: 'my-group/odd-jobs'
file: '/templates/.db-mirror.yml'
your .db-mirror.yml file
db-mirror:
stage: odd-job
script:
- echo something
only:
refs:
- master
- schedules
variables:
- $CI_COMMIT_MESSAGE =~ /[db-mirror]/
Upvotes: 1
Reputation: 1668
These "odd jobs" are not part of your CI pipeline, as you mentioned. Why not put them in their own repo?
Upvotes: 0