We have a monorepo with new services added regularly, each one is under a new folder. I was going to use dynamic configuration to trigger workflows/jobs according to the changed path. I’ve been following this tutorial.
My problem is that I don’t want developers to edit the config file every time a new service is added. In the example below 4 paths are mapped to 4 parameters that are used to trigger workflows, but I must know the paths and parameter names in advance.
workflows:
setup:
jobs:
- path-filtering/filter:
base-revision: master
mapping: |
data/.* config-data-modified true
service/common/.* service-layer-modified true
service/site-api/.* run-site-api-workflow true
service/batch/.* run-batch-services-workflow true
Is there any way to generate this mapping on the fly?
Let’s say there was a change in a file under the path ‘service/new_service’. So I would want the setup config file to get the changed paths from git, and generate the correct mapping:
service/new_service/.* run-new_service-workflow true
as if I gave it a pattern:
service/<git-param-of-changed-folder-name->/.* run-<git-param-of-changed-folder-name->-workflow true
Another possible solution is that I will have a script that builds the needed continuation yaml file with the required jobs, but I still need my script to know the names of changed protocols coming from git so I can only run the needed tests.
Any ways to achieve this?