I want to manage multiple sub-projects in same Git repositry while at same time being able to seperate their builds in Jenkins. That is Jenkins builds only the sub-project I pushed changes for and dependent modules.
- Approach: Initialy I had one Git repository for
root
and sub-projects
root/lib (Java project)
root/server (Java project)
root/weblcient (npm Vue.js project)
The disadvantage for this was that there is only on Jenkin job for the root repo and if I push a change to webclient
Jenkins will build lib
and server
without any need. Long waiting time until I get Jenkins's feedback for webclient
. Thats why I switched to git sub-modules.
- Approach: Project
root
is the git repo with 3 git submodules.
root/lib (Java project)
root/server (Java project)
root/weblcient (npm Vue.js project)
This way I can have 3 jobs in Jenkins and build only when needed. But it separates the git history for the sub-projects. This requires more steps when I have a feature/fix which affects multiple sub-projects
(e.g.
- feature branch on lib.
- pull request on lib.
- feature branch on server
- pull request on server ... ).
Whereas on the first method I will create a single feature branch and one pull request.
Is there a way to have one Git repository with multiple sub-projects (and thus multiple Jenkins jobs)? I would also consider switching to a different source code versioning tool.
question from:
https://stackoverflow.com/questions/65919268/manage-sub-projects-in-jenkins-build-with-git 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…