Jenkins拥有多个项目和git分支 [英] Jenkins with multiple projects and git branches

查看:570
本文介绍了Jenkins拥有多个项目和git分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个Jenkins作业,它将构建我所有的子项目A,B,C和D.对于这些子项目中的每一个,它应该检查git存储库,如果发生更改* / develop, * / release / xx和* / master分支。如果其中一个有变化,它应该为该分支和该子项目构建(并运行单元测试)。
我尝试使用multi-config-pluging,它与我想要的非常接近。这适用于每晚构建,但不适用于git-update-triggered构建。我可以在运行Ant之前使用shell脚本来完成这个工作。



主要问题是:我不能使用配置参数(如SUB_PROJECT = A,BRANCH = release / 1.0)作为SCM参数。当我将git respository url设置为git@bitbucket.org:mine / $ SUB_PROJECT.git,并将分支设置为* / $ BRANCH时,它不会用值替换参数。



我不喜欢jenkins-autojobs或jenkins-build-per-branch解决方案,因为我不想在一项工作完成时创建12个以上的工作。 / p>

任何想法如何解决这个问题? 解决方案

类似于以下内容:



我建议使用 Gerrit ,它可以与Jenkins集成。提交的补丁程序是以分支机构的形式实现的,这些分支机构会自动满足Jenkins的工作要求。



这可能不是一个完整的解决方案,但会外包管理短期特性分支。


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. 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. This works fine for nightly builds, but not for git-update-triggered builds. I can make this work using a shell script that will clone the desired repository and branch before running Ant.

Main problem is this: I cannot use the configuration parameters (like SUB_PROJECT=A, BRANCH=release/1.0) as SCM arguments. 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.

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.

Any ideas how to solve this?

解决方案

This question is very similar to the following:

I recommended using Gerrit which can be integrated with Jenkins. Submitted patches are implemented as branches which are automatically verfied with a Jenkins job.

This may not be a complete solution, but would outsource the problem of managing short-lived feature branches.

这篇关于Jenkins拥有多个项目和git分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆