[JIRA] [workflow-plugin] (JENKINS-32658) Multibranch pipeline 'checkout scm' does not handle Git submodules

328 views
Skip to first unread message

colin@gibibit.com (JIRA)

unread,
Jan 27, 2016, 1:50:01 PM1/27/16
to jenkinsc...@googlegroups.com
Colin Bennett created an issue
 
Jenkins / Bug JENKINS-32658
Multibranch pipeline 'checkout scm' does not handle Git submodules
Issue Type: Bug Bug
Assignee: Jesse Glick
Components: workflow-plugin
Created: 27/Jan/16 6:49 PM
Labels: multibranch git git-submodule
Priority: Minor Minor
Reporter: Colin Bennett

When using a Multibranch Pipeline job type, the Jenkinsfile in the SCM repository branch being built contains the statement checkout scm. But if the Git repository contains submodules, they are not initialized or updated in the Jenkins build workspace.

Typically submodule initialization/updating is automatically handled by the Git SCM for Jenkins Freestyle jobs.

Workaround

You can call the git executable manually from the Jenkinsfile pipeline DSL, like this:

        checkout scm
        execute 'git submodule update --init'
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

colin@gibibit.com (JIRA)

unread,
Jan 27, 2016, 1:51:01 PM1/27/16
to jenkinsc...@googlegroups.com
Colin Bennett updated an issue
Change By: Colin Bennett
When using a Multibranch Pipeline job type, the Jenkinsfile in the SCM repository branch being built contains the statement {{checkout scm}}.  But if the Git repository contains submodules, they are not initialized or updated in the Jenkins build workspace.


Typically submodule initialization/updating is automatically handled by the Git SCM for Jenkins Freestyle jobs.

h4. Workaround

You can call the {{git}} executable manually from the Jenkinsfile pipeline DSL, like this:
{noformat}
        checkout scm
        execute         bat  'git submodule update --init'      // or sh
{noformat}

colin@gibibit.com (JIRA)

unread,
Jan 27, 2016, 1:53:01 PM1/27/16
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Feb 18, 2016, 11:02:01 AM2/18/16
to jenkinsc...@googlegroups.com
Jesse Glick resolved as Duplicate
Change By: Jesse Glick
Status: Open Resolved
Resolution: Duplicate

jglick@cloudbees.com (JIRA)

unread,
Feb 18, 2016, 11:02:01 AM2/18/16
to jenkinsc...@googlegroups.com
Jesse Glick commented on Improvement JENKINS-32658
 
Re: Multibranch pipeline 'checkout scm' does not handle Git submodules

I think you would need to configure the SCM source to include the submodule extension.

stan.domula@smartrac-group.com (JIRA)

unread,
Jul 22, 2016, 10:15:04 AM7/22/16
to jenkinsc...@googlegroups.com

Jesse Glick how to set the extension config on scm? I can create a custom checkout(...) call. but than it makes no sense in a multibranch project with Jenkinsfiles.

This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

stan.domula@smartrac-group.com (JIRA)

unread,
Jul 22, 2016, 10:27:02 AM7/22/16
to jenkinsc...@googlegroups.com
Stan Domula edited a comment on Improvement JENKINS-32658
[~jglick] how to set the extension config on scm? There is no function in GitSCM class to set the extensions except with the constructor. I can create a custom checkout(...) call. but than it makes no sense in a multibranch project with Jenkinsfiles.

stan.domula@smartrac-group.com (JIRA)

unread,
Jul 28, 2016, 6:39:01 AM7/28/16
to jenkinsc...@googlegroups.com
Stan Domula updated an issue
 
Change By: Stan Domula
Comment:
[~jglick] how to set the extension config on scm? There is no function in GitSCM class to set the extensions except with the constructor. I can create a custom checkout(...) call. but than it makes no sense in a multibranch project with Jenkinsfiles.

stefan.freyr@gmail.com (JIRA)

unread,
Dec 10, 2016, 9:43:06 AM12/10/16
to jenkinsc...@googlegroups.com
Stefan Freyr Stefansson commented on Improvement JENKINS-32658
 
Re: Multibranch pipeline 'checkout scm' does not handle Git submodules

This workaround does not always work. The scm credentials used to check out the repository are not available in the sh line so you can get an access denied.

Is there any way to execute the submodule command in the same context as the `checkout scm` is being run?

jenkins@uhp-software.com (JIRA)

unread,
Mar 17, 2017, 12:58:10 PM3/17/17
to jenkinsc...@googlegroups.com
UHP commented on Improvement JENKINS-32658

There is a solution for that using the approaches described in https://support.cloudbees.com/hc/en-us/articles/226122247-How-to-Customize-Checkout-for-Pipeline-Multibranch

Problem for us is that calling

checkout([
        $class: 'GitSCM',....])

seems to create the "impression" that another repo is used. We get the error
None or multiple repos
when we call "bitbucketStatusNotify(...)"

 

This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

rdecarre11@gmail.com (JIRA)

unread,
Sep 27, 2018, 8:33:05 PM9/27/18
to jenkinsc...@googlegroups.com
Robert Decarreau assigned an issue to Unassigned
 
Change By: Robert Decarreau
Assignee: Robert Decarreau
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

rdecarre11@gmail.com (JIRA)

unread,
Sep 27, 2018, 8:33:05 PM9/27/18
to jenkinsc...@googlegroups.com

jsmith@zivra.com (JIRA)

unread,
Sep 26, 2019, 10:55:05 AM9/26/19
to jenkinsc...@googlegroups.com
james smith commented on Improvement JENKINS-32658
 
Re: Multibranch pipeline 'checkout scm' does not handle Git submodules

I ran into this problem today, submodules not being checked out, and the problem in my case was that I added the submodules to use ssh, but the multibranch pipeline uses https to do the git checkout. Once I updated my .gitmodules to use https urls it worked fine.

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages