Search code examples
gitjenkinsgit-submodules

Git submodules not updating in Jenkins build


I have a submodule in a project in Jenkins. I've enabled the advanced setting to recursively update submodules.

When I run the build, I see that the workspace has the files from the submodule. The problem is, it seems to be the first revision of the submodule. When I push changes (repository hosted on GitHub) Jenkins doesn't seem to update the submodule to get the right changes. Has anyone ever seen this?


Solution

  • It looks like I found a solution:

    I added a build step to execute the following shell commands:

    git submodule foreach git checkout master
    git submodule foreach git pull