0

I have a multi-module maven project. I want to configure it as a jenkins pipeline so that whenever there is a commit in any of the sub-modules, it should trigger building of the pipeline

I have enabled the following option

Checked - Update tracking submodules to tip of branch

[$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, recursiveSubmodules: true, reference: '', timeout: 60, trackingSubmodules: true]

Nothing gets triggered when a commit happens in any of the submodules. Please suggest

  • So you have your project constructed that every `mvn` submodule is actually a submodule in `git` with its own repository? – hakamairi May 28 '19 at 09:56
  • @hakamairi yes, I have 4 maven projects which correspond to 4 separate repos. But those 4 contribute to a dependency graph. So I created a parent project and configured these 4 projects as submodules. – Sakshi Arora May 28 '19 at 10:01
  • Please have a look - https://stackoverflow.com/questions/33714318/how-to-get-submodules-to-trigger-a-jenkins-build – hakamairi May 28 '19 at 10:05
  • @hakamairi thanks for sharing I read that post earlier. What I understood was first answer - If I have 10 submodules, then I will be creating 11 Jenkins jobs (10 for the submodules and 1 for parent). And this post was a bit old, I thought may be there have been some improvements in Jenkins which have enabled the recursive tracking of the submodules. – Sakshi Arora May 28 '19 at 10:16
  • The Second solution says that I can create only one job in Jenkins(for parent) and for every submodule, I can configure their web hook to run the job whenever a commit happens in any of them. I haven't tried that yet since I was facing some issues configuring the web hook. But I will definitely check that. Please let me know if there is something better I can try that would help me solve the problem, I am quite new to Jenkins, so really don't know the best practices – Sakshi Arora May 28 '19 at 10:17
  • I guess the bottom line is that triggering by submodules is not supported by OOTB triggers. You need the push or some other triggering mechanizm. – hakamairi May 28 '19 at 10:18
  • @hakamairi yes, looks like that. thanks for the replies. – Sakshi Arora May 28 '19 at 10:36

0 Answers0