how to trigger build in jenkins when changes committed to submodule?
When a git repository has a submodule it points to a specific commit in that submodule (say commit A
). So even if the submodule changes and now has commit B
as a child of A
your top level repository is still pointing at commit A
. You must explicitly update your top level repository to point at commit B
in the submodule, it will not happen automatically.
Given this, the answer to your question is, just update your top level repository to point to the new commit B
. This will cause a change in your repository which should trigger a Jenkins build just like it normally would, this will pick up the new commit B
from the submodule.
--
Given the extra information I would add a Jenkins job that watches the submodule repositories. When a submodule changes do whatever submodule specific test you have then as a post build step trigger the main repository job.