I’m trying to create a parent child pipeline on Gitlab using gitlab-ci but I need to share variables from parent to child pipeline. I’m using the “options” capability to have a drop down menu with pre-filled values just to avoid TYPO while filling the variable. Is there any way to create the options starting from a bash script?
For example:
variables:
- myVar
options:
script:
- find -type f | grep microservices
Thank you! Cheers
There's no native solution for this. However, I've approximated something like this using pre-commit
hooks.
Basically, there is a pre-commit
hook script that will generate the possible choices and edit the variables:
key in the .gitlab-ci.yml
to contain all the appropriate options whenever they change. I also setup pre-commit autofixing in the GitLab pipeline so you never have stale options.