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

Multibranch pipeline doesn't trigger on Git submodule changes

      Currently, the multibranch pipeline does not trigger builds if the pipeline is pointed to a Git repo with submodules and one of the submodules changes. This is different from the SCM polling behavior of a single-branch pipeline, which does trigger rebuilds on a change to a submodule. I categorize this as a bug because I would expect the multibranch pipeline to poll for changes in the same way as a single-branch pipeline.

          [JENKINS-49434] Multibranch pipeline doesn't trigger on Git submodule changes

          Mark Waite added a comment -

          Can you provide more detail of what you mean when you say:

          one of the submodules changes

          For example, do you mean one (or more) of these scenarios:

          1. a single branch pipeline detects a case where a commit is submitted to a submodule repository without any commit being submitted to the parent repository. That would be unexpected (at least for me), since a submodule commit is not used unless a commit is made to the parent module to point it to the new commit in the submodule
          2. a single branch pipeline detects a case where a commit is submitted to a submodule repository and a commit is submitted to the parent repository. That should be detected as a new commit in the parent repository and should be detected by the single branch pipeline when it polls or is notified by a web hook and should be detected by the multi-branch pipeline when it scans the repository or is notified by a web hook

          Mark Waite added a comment - Can you provide more detail of what you mean when you say: one of the submodules changes For example, do you mean one (or more) of these scenarios: a single branch pipeline detects a case where a commit is submitted to a submodule repository without any commit being submitted to the parent repository. That would be unexpected (at least for me), since a submodule commit is not used unless a commit is made to the parent module to point it to the new commit in the submodule a single branch pipeline detects a case where a commit is submitted to a submodule repository and a commit is submitted to the parent repository. That should be detected as a new commit in the parent repository and should be detected by the single branch pipeline when it polls or is notified by a web hook and should be detected by the multi-branch pipeline when it scans the repository or is notified by a web hook

          Chris Reffett added a comment -

          Sure, I'm referring to the former. In the single-branch pipeline, Jenkins was set to update the submodules to their tip, and that registered as an SCM change and triggered a build. In the multibranch pipeline, the same behavior is set, but the Scan Multibranch Pipe Log shows that Jenkins is only checking the top-level repo's commit ID for changes.

          Background on our configuration: My organization has several components in their own repos and then combines them as sub-modules of a "master" repository to build (with the master repository having a few other things, like a pom.xml and Jenkins config). Since we don't care about the submodules pointing to a specific commit on our develop branch, our .gitmodules config points to the develop branch and has ignore=all set.

          Chris Reffett added a comment - Sure, I'm referring to the former. In the single-branch pipeline, Jenkins was set to update the submodules to their tip, and that registered as an SCM change and triggered a build. In the multibranch pipeline, the same behavior is set, but the Scan Multibranch Pipe Log shows that Jenkins is only checking the top-level repo's commit ID for changes. Background on our configuration: My organization has several components in their own repos and then combines them as sub-modules of a "master" repository to build (with the master repository having a few other things, like a pom.xml and Jenkins config). Since we don't care about the submodules pointing to a specific commit on our develop branch, our .gitmodules config points to the develop branch and has ignore=all set.

          Jon Roberts added a comment -

          We have a similar setup.  We have our develop parent branch tracking the tip of develop submodules.  In Jenkins I had to setup watch jobs that monitor the develop submodules for changes then kick off the parent develop build.  All that works great.   Now I'm trying to figure out how to do something similar with a multibranch pipeline.   It'd be great if I could somehow monitor the submodule projects then kick off the the parent project again, but specify which submodule branches to checkout.  

          I think you can setup multiple sources for your submodule projects.  The the Jenkinsfile would then have to checkout the parent project and build all the things.   Probably would need to duplicate/have similar jenkinsfiles in each submodule, since they would all have to know how to build themselves from the parent.

          Jon Roberts added a comment - We have a similar setup.  We have our develop parent branch tracking the tip of develop submodules.  In Jenkins I had to setup watch jobs that monitor the develop submodules for changes then kick off the parent develop build.  All that works great.   Now I'm trying to figure out how to do something similar with a multibranch pipeline.   It'd be great if I could somehow monitor the submodule projects then kick off the the parent project again, but specify which submodule branches to checkout.   I think you can setup multiple sources for your submodule projects.  The the Jenkinsfile would then have to checkout the parent project and build all the things.   Probably would need to duplicate/have similar jenkinsfiles in each submodule, since they would all have to know how to build themselves from the parent.

            Unassigned Unassigned
            chris_reffett Chris Reffett
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: