开发者

Jenkins: settings for Gerrit Trigger problems

开发者 https://www.devze.com 2023-04-08 01:18 出处:网络
I\'ve installed the plugin Gerrit Trigger on开发者_如何学JAVA Jenkins cos I need to start automatically the building when a developer in the team pushes something on the repository (relative to a spec

I've installed the plugin Gerrit Trigger on开发者_如何学JAVA Jenkins cos I need to start automatically the building when a developer in the team pushes something on the repository (relative to a specific project). I followed the settings here:

https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger

The test connection is ok. Anyway when something is pushed the building doesn't "trigger". The only thing I can see is:

Under "Manage Jenkins" -> The connection to Gerrit is down! Check your settings and the Gerrit server.

any idea?

thanks

randomize

BTW I got this:

BTW I got this: Command "git fetch -t git@github.com:somewhere/MyProject.git $GERRIT_REFSPEC" returned status code 128: fatal: Couldn't find remote ref $GERRIT_REFSPEC fatal: The remote end hung up unexpectedly

 ERROR: Could not fetch from any repository
 FATAL: Could not fetch from any repository
 hudson.plugins.git.GitException: Could not fetch from any repository
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1008)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:968)
at hudson.FilePath.act(FilePath.java:758)
at hudson.FilePath.act(FilePath.java:740)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:968)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1184)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:537)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:425)
at hudson.model.Run.run(Run.java:1376)


There is trick described on the Gerrit plugin page:

Normally when you have configured a job to be triggered by Gerrit you can't use the "Build Now" link anymore since your builds are dependent on information from Gerrit, especially if you are using the Git plugin to checkout your code in the workspace.

You can get around this limitation if you for example want to use the same job to build the master branch at some point. If you are using the Git plugin do the following

Add a String parameter called GERRIT_REFSPEC with the default value refs/heads/master

Using this trick will enable you to build, but no results will be sent to Gerrit since tit is not triggered by it.


That doesn't work with the Gerrit trigger, because then the variable $GERRIT_REFSPEC isn't set. If you want to manually trigger a changeset from Gerrit, you have to use the "Query and Trigger Gerrit Patches". There you can search for open changes in Gerrit and build them.

You should also notice, that a build is only triggered, if you have pushed the changes to the review branches in Gerrit, e.g. a refs/for/ reference. If you pushed directly to the branches (e. g. refs/heads/master), because you don't want to do code review, the Gerrit trigger doesn't work. You would have to use one of the Gerrit hooks, that calls a URL which starts a build or let the build job poll your Git repository.


in our case, we had to restart the jenkins service. this looks to be a bug with the gerrit trigger plugin (we're on 2.27.5)


You Need to start the gerrit server from the jenkin>> gerrit trigger> click on status icon.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号