How to Gerrit Trigger builds only for a certain part of the project

I'm using Jenkins integrated with git and gerrit trigger.

I manage a huge repo that leads with a big amount of commits. So i'm not interested on running a complete build of the whole project on every push. The idea here is just build the especific project .pom file where there is code changes.

For example:

    -"common" is a subdir with its own .pom 

    -"persistence" is a subdir with its own .pom. "persistence" depends on common dir.

So if there is a change on persistence dir i have to build only the persistence .pom file because it will build common as a dependencie. On the other hand if someone change code on common, the jenkins do not have the necessity of building persistence. So it will save me time and hw resources.

So the question here is how could i do this? Does gerrit trigger have any support for this?

Update: On selecting the changed files does the file RegEx option refers to the file Path or the file name?

And also, is there a way to, using file RegEx field, express something like build "if changes in common and not changes in persistence"?


Have you tried to use Dynamic Trigger Configuration? you define a filter - on which change the job should start. So you create jobs for each build then define a proper gerrit trigger with filter. Or if you want to use only 1 job for every build - then write a script where you can use git to determine which file was changed and then select the right project file for it.

Update: try to play with New build parameter: GERRIT_TOPIC
So push your changes with a proper TOPIC name eg

git push origin HEAD:refs/for/master/topic_name 

where topic_name can be common, persistence the topic name can be filled automatically with pre-push hook in git.

链接地址: http://www.djcxy.com/p/26662.html

上一篇: 我如何找到两个git提交之间的交集?

下一篇: Gerrit触发器如何构建仅适用于项目的某个部分