how to trigger build in jenkins when changes committed to submodule?

We have a git repository with external submodules. We have to trigger a build when submodule was changed. Could you advice to us how to poll changes on submodules with your xtrigger plugin. Is it better to use shell script or monitor files or something else?

more information about our build brocess.
step #1. clone root repository with submodules
step #2. execute job for each submodule
step #2.1 (in submodule). switch to proper branch (for example, master)
step #2.1 (in submodule). pull the latest sources for submodule

  • Setting up sparkleshare but keeping old ssh credentials
  • What is the proper way to include a file once into a repository and then ignore subsequent changes?
  • If a git tag changes on remote, a git fetch does not update it locally. Is this a bug?
  • When was a file added to a branch in Git?
  • Keeping feature branch up to date
  • git svn dcommit does not find changes and reset head
  • now if somebody commits to root repository, jenkins launches build for the app
    but if somebody commits to any submodule repository, jenkins doesn’t launch anything

    we need solution for the second case. in best case it should be done via standard jenkins functionality or via open source plugin.

  • Migration from svn to git: How do I create .gitignore files for a big repository with an unstable connection?
  • How to git diff multiple sibling git folders
  • Git Diff between HEAD and SVN Master
  • How do larger github projects combine files
  • Does git know which branch is which after a merge?
  • TeamCity build labeling failing intermittently on a git repository
  • One Solution collect form web for “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.

    Git Baby is a git and github fan, let's start git clone.