0

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"?

adolfosrs
  • 9,286
  • 5
  • 39
  • 67
  • 1
    You might need to reconfigure your project so each of your subproject is a git submodule. Then you might create different builds for each submodule and launch them independently. Read more about git submodules here http://goo.gl/uHoS8r and how to work with them in Gerrit here http://goo.gl/cZ0E24. Please note that I never tried such configuration but it might be a good start point to achieve what you want. – fracz Sep 03 '14 at 21:30

1 Answers1

1

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 e.g.

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.

Community
  • 1
  • 1
laplasz
  • 3,359
  • 1
  • 29
  • 40
  • Yeah, i tried. But it seems to me that dynamic trigger conf doesnt have any support to verify the case when (using my example again) i have changes on both dir and so i do not have to run the build for common because common is a dependencie on persistence. Im not sure im being clear... – adolfosrs May 06 '14 at 12:26
  • the update in my answer tells that you can select 'manually' which build/job should be triggerd – laplasz May 06 '14 at 13:34
  • Yeah, i can't think in another way to do this. But this solution you gave (and thank you very much for it) seems not to be the cleaner one. I will keep searching. – adolfosrs May 06 '14 at 21:03