lesfurets/partial-build-plugin

Exclude directories from change detection

blaz1 opened this issue · 2 comments

blaz1 commented

Imagine following project structure:

Project
- documentation/...
- kubernetes_configuration/...
- Module_A/...
- Module_B/...
- Module_C/...
- pom.xml
- gitlab-ci.yml (*configures gitlab pipeline*)

Using partial-build-plugin, if any changes are done to documentation/..., kubernetes_configuration/... or gitlab-ci.yml, the whole project (all 3 modules) gets rebuilt. But the mentioned changes are completely irrelevant to the maven build process and also do not directly affect the application or modules. Thus, making documentation changes unneccesarily triggers a complete rebuild.

I think this is because the code in ChangedProjects::findProject goes to the root EAR project if it doesn't find any module before reaching the root folder.

To avoid this, an additional configuration option could be provided, that would accept comma separated list of directories to ignore when deciding what to rebuild. Wildcard support would be an added benefit. For before mentioned project structure it could look like:

<ignore>documentation,kubernetes_configuration,gitlab-ci.yml</ignore>
blaz1 commented

As a quick fix, I dynamically turn on or off the ignoreAllReactorProjects property in my CI/CD pipeline. I check if any changes were done to reactor pom.xml through git log (checking for last commit and exact match of pom.xml since it is located at root of project, but modules also contain their own POMs):

export IGNORE_REACTOR_PROJECTS='git log --name-only -1 | grep -q -e "^pom.xml$" && echo false || echo true'

and if yes, the flag ignoreAllReactorProjects is set to false, otherwise it is set to true (meaning changes to any files that do not fall under modules are ignored by partial-build-plugin.

Yes the described feature request is totally relevant. An ignoreFiles option can be added. It should be implemented in DifferentFiles.