Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-44170

Support for initializing and updating submodules before automatic merge

      I get errors like

      Failed to merge submodule XXX (not checked out)
      

      in a multibranch pipeline project I use to automatically merge and build pull requests because it fails to initialize and update submodules automatically. There should be a way to do that by configuration, I think.

      As a workaround I had to add a git hook to do it on each checkout (feel free to use it if you need):

      mkdir -p ~/.git-templates/hooks
      git config --global init.templatedir '~/.git-templates'
      echo -e '#!/bin/sh\ngit submodule update --init --recursive' > ~/.git-templates/hooks/post-checkout
      

      It's definitely not the cleanest solution so I strongly suggest a long-term solution for that.

          [JENKINS-44170] Support for initializing and updating submodules before automatic merge

          Marc Neureiter created issue -
          Marc Neureiter made changes -
          Description Original: I get errors like
          {code:java}
          Failed to merge submodule XXX (not checked out)
          {code}
          in a multibranch pipeline project because it fails to initialize and update submodules automatically. There should be a way to do that by configuration, I think.

          As a workaround I had to add a git hook to do it on each checkout (feel free to use it if you need):
          {code:java}
          mkdir -p ~/.git-templates/hooks
          git config --global init.templatedir '~/.git-templates'
          echo -e '#!/bin/sh\ngit submodule update --init --recursive' > ~/.git-templates/hooks/post-checkout
          {code}
          It's definitely not the cleanest solution so I strongly suggest a long-term solution for that.
          New: I get errors like
          {code:java}
          Failed to merge submodule XXX (not checked out)
          {code}
          in a multibranch pipeline project I use to automatically merge and build pull requests because it fails to initialize and update submodules automatically. There should be a way to do that by configuration, I think.

          As a workaround I had to add a git hook to do it on each checkout (feel free to use it if you need):
          {code:java}
          mkdir -p ~/.git-templates/hooks
          git config --global init.templatedir '~/.git-templates'
          echo -e '#!/bin/sh\ngit submodule update --init --recursive' > ~/.git-templates/hooks/post-checkout
          {code}
          It's definitely not the cleanest solution so I strongly suggest a long-term solution for that.

          I think this is a common problem and there is no proper workaround within Jenkins!

          Marc Neureiter added a comment - I think this is a common problem and there is no proper workaround within Jenkins!
          Marc Neureiter made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          Matthew DeTullio made changes -
          Component/s New: pipeline [ 21692 ]
          Component/s Original: multi-branch-project-plugin (not Pipeline) [ 21127 ]
          Matthew DeTullio made changes -
          Assignee Original: Matthew DeTullio [ mjdetullio ]
          Andrew Bayer made changes -
          Component/s New: github-branch-source-plugin [ 20858 ]
          Component/s Original: pipeline [ 21692 ]

            Unassigned Unassigned
            marcodeneu Marc Neureiter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: