If you have a couple of microservices inside a single git repository and for each microservice there is a Jenkins Job sharing the same Jenkinsfile. e. g. https://github.com/Xaseron/phippyandfriends
The goal is that the pipeline for each microservice is only run if a change is made in the subdirectory or the build is triggered manually.
The current possible solution is kind of ugly: (the job is multibranch pipeline named after the microservice e.g. captainkube)
The down side of this a approach is:
- Meta stage for the when block (or the same when block in every stage)
- every commit triggers a build even if there was no change in the subdirectory of the microservice
One possible solution would be to allow the when block at the toplevel and don't start a build when it is not matched.