I’m new to Jenkins and I currently want to try to do something in a way like this: I have a YAML configuration file, and for simplicity’s sake, let’s just say that essentially it is a hierarchal yaml that contains repository paths, and each one has a “dependencies” property that contains more repository paths for builds, and each of those could potentially have another dependencies property, etc.
So I’ve created a Groovy Jenkinsfile that will essentially parse this YAML, and currently it works properly and is simple in that it just breaks all of the parents and their children into different layers and runs all the paths that are in the same layer in parallel, similar to a breadth-first search. The issue is that I don’t want to wait for all the members of layer 1 to finish before starting layer 2. I need every dependency/child to wait for its parent to finish before it starts, so I can’t just shove them all into one big parallel after parsing the file, but I don’t want a child/dependency to have to wait on a parent other than its own before beginning. Since I’m new, I’d like to see if there’s a way to contain it all into one Jenkinsfile, and something I was thinking about was basically doing something like creating a queue of stages and the queue continues to grow as each item finishes and adds its children to it until the queue is empty, but I’m limited by being forced to use the parallel keyword/method and its specifications of requiring a map of what to run in parallel. I am still open to any other suggestions for how to fix this. Here is a simplified snippet of the YAML:
So the idea is that on line 19, base-3-2 shouldn’t need to wait for base-2 to finish before starting, it should only need to wait for base-2-1 and (indirectly since base-2 shouldn’t start without it) base-1. Any ideas for how to do this in one Jenkinsfile that’s in the root directory of the repository?