I need some help brainstorming a solution for multiproject repositories.
Pipeline building a repository that contains several delivery projects.
The root of the repository contains several delivery projects.
- delivery-project
- delivery1
- CMakeList.txt
- delivery-project-delivery1.spec
- src
- delivery2
- CMakeList.txt
- delivery-project-delivery2.spec
- delivery3
- CMakeList.txt
- delivery-project-delivery3.spec
- src
I could keep one Jenkinsfile on the root. Then iterate through all directories and build each delivery.
However when there is an SCM change in only one of the deliveries I only want that one to be built.
This could be solved if I could determine which directory has been changed. Something like this (ignore closure which doesn't work in Pipeline):
changedDirectories.each { directory ->
dir(directory) {
doBuild()
}
}
Though I'm not sure how to get the SCM changes to determine this.
Considering this delivery git repository will only have a master branch, a Multibranch Pipeline project is not necessary, and a standard Pipeline job would suffice.
I could also create a Folder job for delivery-project, and one Pipeline job for each delivery. Each subproject could contain its own Jenkinsfile which would be specified in the configuration in Script Path as delivery1/Jenkinsfile. However when a new delivery project is added to the repository it would require me to manually add a new Pipeline job for it.