Search code examples
gitjenkinsjenkins-workflow

How to run specific Jenkins Job for a large number of projects


I'm a newbie in Jenkins and have some problems about how to configure it in order to run some specific Job (let's call it code-check-syntax) for a very large number of projects (repositories) from Gerrit. Let's say that all those projects have some kind of prefix and start from abc prefix, e.g.

  • abc/project1
  • abc/project2
  • abc/project3/subproject
  • ...

So, I'd like to run code-check-syntax Job for every patch-set created in any of those repositories.

P.S. It works for me good for a single repository (in Jenkins Freestyle type Job, SCM --> Git), but what if the number of repositories can be any. It seems to me that Jenkins Pipeline Plugin can be useful in this case, but can't figure out how to use it.


Solution

  • After some time of researching, I found out that one can use Gerrit parameters provided to the build. In this particular case we can use $GERRIT_PROJECT parameter to address specific gerrit project.

    enter image description here