Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
231 views
in Technique[技术] by (71.8m points)

Manage sub-projects in jenkins build with git

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.

  1. 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.

  1. 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.

  1. feature branch on lib.
  2. pull request on lib.
  3. feature branch on server
  4. 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...