简体   繁体   English

Jenkins有多个项目和git分支

[英]Jenkins with multiple projects and git branches

I would like to create one Jenkins job, that will build all my sub-projects A,B,C and D. For each of these sub-projects it should check the git repository if there are changes the */develop, */release/xx and */master branches. 我想创建一个詹金斯工作,它将构建我的所有子项目A,B,C和D。对于每个子项目,应检查git存储库中是否存在* / develop,* / release的更改。 / xx和* / master分支。 If there are changes in one of them, it should build (and run unit tests) for that branch and that subproject. 如果其中之一发生更改,则应该为该分支和该子项目构建(并运行单元测试)。 I tried using the multi-config-pluging, which works pretty close to what I want. 我尝试使用multi-config-pluging,它的工作原理与我想要的非常接近。 This works fine for nightly builds, but not for git-update-triggered builds. 这对于每晚的构建都很好,但是对于git-update触发的构建则不行。 I can make this work using a shell script that will clone the desired repository and branch before running Ant. 我可以使用Shell脚本来完成这项工作,该脚本将在运行Ant之前克隆所需的存储库和分支。

Main problem is this: I cannot use the configuration parameters (like SUB_PROJECT=A, BRANCH=release/1.0) as SCM arguments. 主要问题是:我不能使用配置参数(例如SUB_PROJECT = A,BRANCH = release / 1.0)作为SCM参数。 When I set the git respository url to "git@bitbucket.org:mine/$SUB_PROJECT.git" and the branch to "*/$BRANCH" it will not substitute the params with the values. 当我将git存储库的url设置为“ git@bitbucket.org:mine / $ SUB_PROJECT.git”并将分支设置为“ * / $ BRANCH”时,它将不会用值替换这些参数。

I don't like the "jenkins-autojobs" or "jenkins-build-per-branch" solutions, since I don't want to create 12+ jobs when one job could do it all. 我不喜欢“ jenkins-autojobs”或“ jenkins-build-per-branch”解决方案,因为我不想在一项工作可以完成全部工作的同时创建12个以上的工作。

Any ideas how to solve this? 任何想法如何解决这个问题?

This question is very similar to the following: 这个问题与以下内容非常相似:

I recommended using Gerrit which can be integrated with Jenkins. 我建议使用可以与Jenkins集成的Gerrit Submitted patches are implemented as branches which are automatically verfied with a Jenkins job. 提交的补丁程序被实现为分支,并自动与Jenkins作业进行验证。

This may not be a complete solution, but would outsource the problem of managing short-lived feature branches. 这可能不是一个完整的解决方案,但是会外包管理短期功能分支的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM