I’d like to conditionally include a file based on some criteria. I’m creating a shared pipeline definition and I’d like to define things and run things only if the project the pipeline it’s running is has specific variables set or if a file exists in the directory. For example, I have language specific yaml files, I’d like to
@cschmidt0n I have exactly the same use case and I badly need to do the same , like I only want 1 specific include to be there based on parameter and I can still keep my pipelines DRY as much as possible.
Would move to see how you defined that in same include file as you described ?
Can you please provide some example for it. @cschmidt0n ?
I have a scenario where I just want to include the child yml only when some variable is met and only run a pipeline for that particular directory.
The stages for all the included pipelines are the same , the only difference is really in the set of variables and semantic-release they use. It would be really helpful to get to only run a single included pipeline and not others hence my ask for conditional include ?
I’d like this as well, was somewhat confused by the logic described for workflow templates – I thought thats what this was, e.g. you have one gitlab-ci.yml for lets say merge requests, and a seperate one for your default branch.
I too would very much like condtionals that use the same if criteria as rules do. I would really like them for include and also extends. Primarily so I can have slightly different builds based on branches and merge requests (eg, build without link-time optimization on some branches)
Just generate the pipeline you want depending on some variables. See e.g. https://gitlab.com/gitlab-org/project-templates/jsonnet, although you don’t have to use jsonnet - you can make your generated pipeline with whatever tools you like.
I am looking to include a complete build pipeline only if that part of my repo has changes.
In my case that is, I would like to run the included terraform ci pipeline only if I have changes in a sub dir. Is that not possible at moment or I am I missing something? My case seems like a thing “everybody” would do?