1

How can I setup a multibranch pipeline job in Jenkins so that the branches of a certain repo are scanned but the branches are tested as submodules of another repo?

I have a project in Bitbucket and I have been successfull in configuring a multibranch pipeline job so that all branches are ran. The issue is that the repo itself serves mostly as a container for another repo, checked out as a submodule, where most of the code is. What I really want to do is have jenkins run CI on that code checked-out as a subrepo.

EDIT: Please note I want to have a multibranch pipeline job. I also want the job to test all branches of the submoudule, not just one. There are other threads explaining how to get a submodule to trigger a build, I however believe this is different.

EDIT2: To clarify. As stated in the second paragrah, I have a repository which serves as a container for another repo (which is included as a sub-module). The code I want to run the CI is in the submodule, I want jenkins to scan that submodule's branches and then run the job on each of those branches. However, the job requires the submodule's repo to be checked as that, a submodule, not as a standalone repo. In Jenkins I have successfully created a job which scans the container repo's branches (let's call it super-repo) and runs the job on each of those branches. The issue is that the super-repo does not have many branches, me and my team mostly work on the other repo (the one included as a submodule) and make commits/pushes to branches on that repo. We rarely make commit/pushes to the super-repo (mostly only when creating releases). Why is that I want the submodule's branches to be scanned instead of the super-repo's ones...

viterbi
  • 419
  • 5
  • 11
  • Possible duplicate of [how to get submodules to trigger a Jenkins build](https://stackoverflow.com/questions/33714318/how-to-get-submodules-to-trigger-a-jenkins-build) – hakamairi May 31 '19 at 19:09
  • I don't think so @hakamairi – viterbi Jun 03 '19 at 11:22
  • Are you asking how to check out the submodule then? – hakamairi Jun 03 '19 at 11:51
  • Anybody? I am sure I am not the first one to want to do this. – viterbi Jun 04 '19 at 09:53
  • It would do help a lot if you would use the terms that jenkins does, so there's no grey area in this question. If I get you right, by testing branches and running on them you mean actually triggering the multibranch pipeline build by polling the submodule's repository for changes. As pointed in my first comment, there's no support for this. – hakamairi Jun 04 '19 at 10:09
  • Where did you say that there was no support for this? all I see is you said the issue was the same as that other one. I guess I could have jenkins scan the submodule's branches as if the job was to be ran on that repo, and then at the time of checkout, check it out as part of the "super-repo" instead of just checking out the submodule's repo. – viterbi Jun 04 '19 at 11:06
  • And how would you know which branch of super project to trigger? – hakamairi Jun 04 '19 at 11:58

0 Answers0