Jenkins build with two github repositories

I have a Django web app repository in github, which contains another github repository as a subtree.

The Django repo has an existing Jenkins job to build and deploy on each commit of the Django repo itself.

To keep it clean, user would make subtree-related changes only on the external repo, and not through the Django repo. Also the subtree repo would have only one branch.

I need to build and deploy the Django app also after each commit on the other repository.

How should a github webhook work in this case? Can the Django Jenkins job receive two webhooks from the Django and subtree repo respectively?

I suppose, if the Django Jenkins job can receive events from subtree repo, the job would just pull the subtree with git subtree pull ... to get the latest code of subtree and run the Django build job as usual.

Can someone point me to some reference on how I can set this up? or any other way to support such a workflow?

If you use the syntax generator (optional) to create a checkout() or git() statement, it should hook into jenkins and jenkins should know in the future that this job uses that repo, so webhooks will trigger it.

1 Like