I have a mono repo (git) which houses multiple microservices that I am working on. On push, the 3rd party build service detects this push and starts processing the build and deployment.
This works great. But now I am trying to optimize this process and I would only like it to build the particular services I have been working on. This means that the build services has to detect which folders have been changed and build those services only.
I have gotten this process to work on Travis pretty well because it has a GIT_COMMIT_RANGE environment variable. So I can get all the commits in my latest push and then across all those commits get the folders that have changed.. this works really well.. but ONLY on travis.
I wish to cut out travis and build my docker images directly on a GCP or whatever other 3rd party container builder I am using, but I only wish to build the folders that have changed.
I am thinking that it might be possible to do this with a git commit hook. Through this hook I can start generating a list of folders to mark for the build server to build, or even start generating a build file (cloudbuild.yaml). Then on some git push hook, (is there even a post-push hook) I reset the contents of the cloudbuild.yaml file locally.