jsaji
jsaji

Reputation: 920

Gerrit Trigger on multiple SCM in jenkins not working

I am trying to setup Jenkins for a project. I use git as the SCM and gerrit as code review tool. My project consist of many repository, so I am using MultipleSCM plugin in Jenkins to check-out different repos. I have configured Gerrit Trigger for initiating a build when code checkin happens. The Problem is that when a user makes a change in any one repo the all, all the other repos gets the same CHANGE details which are not valid in any other repo.

    > git rev-parse 873a6b7209411fa825f35da1c6fbc7f280cff06b^{commit} # timeout=10
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Finished: FAILURE

How to solve the problem? Please help. Is there any work around. Thanks in advance.


Jenkins Version: 1.588 Plugins Used: git, gerrit-trigger, multiple-scm. I have two gerrit projects (gerrit1 and gerrit2). I am using both the gerrit project in same jenkins job(because they are dependent). If one developer makes a change in gerrit1 and push to gerrit, Jenkins get a trigger and start building. This work fine when there is one gerrit project. But in my case, if there is a change in gerrit1, gerrit2 will have the same change parmeters in jenkins. Hence the checkout fails for the gerrit2 since the branches may be different.

Upvotes: 5

Views: 1712

Answers (3)

Flows
Flows

Reputation: 3863

Maybe a good solution would be to create git submodules. The Parent one Will contain all actual repositories

Upvotes: 0

grundic
grundic

Reputation: 4921

I encountered the same problem and was able to configure Gerrit trigger with Multiple SCMs plugin. Here is my solution (actually, this was one of the recommendations from Gerrit plugin page):

  1. For git repository which you would like to configure click on Advanced button and put to Refspec field this: refs/changes/*:refs/changes/*
  2. Also for the same repository configure Branch Specifier like this: $GERRIT_REFSPEC

After that triggered builds in Jenkins were updated to correct branch/ref.

Upvotes: 0

Ivan
Ivan

Reputation: 2330

Those do not support each other. You'll want to create a separate job and trigger for each repository.

Upvotes: 0

Related Questions