Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 316
Ben Avatar asked Mar 31 '12 05:03

Ben


2 Answers

Note that the Jenkins Git plugin 2.0 will have "advance submodule behaviors", which should ensure proper updates of the submodules:

git 2.0

As commented by vikramvi:

Advanced sub-modules behavior > "Path of the reference repo to use during submodule update" against this field , add submodule git url.

Path


Owen B mentions in the comments:

For the authentication issue, there's now a "Use credentials from default remote of parent repository" option

Seen here in JENKINS-20941:

https://issues.jenkins-ci.org/secure/attachment/33245/Screen%20Shot%202016-07-08%20at%2010.09.17.png

like image 108
6 revs Avatar answered Oct 04 '22 18:10

6 revs


This is covered in the Git Plugin documentation on the Jenkins site under the section: Recursive submodules.

excerpt

The GIT plugin supports repositories with submodules which in turn have submodules themselves. This must be turned on though: in Job Configuration -> Section Source Code Management, Git -> Advanced Button (under Branches to build) -> Recursively update submodules.

Example

From the configuration screen of your job, in the Source Code Management section, pull the Add button down select "Advanced sub-modules behavior".

   s1

                                 s2

Then select "Recursively update submodules":

   s3

like image 42
slm Avatar answered Oct 04 '22 19:10

slm