本文介绍了Jenkins Gerrit触发器在构建时未获取我的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用gerrit触发器插件配置了jenkins,以验证我们推送到gerrit的每个提交.我希望此触发器将我的最新更改包含在原始回购中并进行构建.但是,它只是克隆回购项目,无需我的更改即可编译.

I have configured jenkins with gerrit trigger plugin to validate every commit we push to gerrit.I am expecting this trigger to include my latest change with original repo and make a build.But, it is cloning only repo project and compiling without my change.

下面是我在jenkins中对gerrit触发器的配置设置.

Below is my configuration settings for gerrit trigger in jenkins.

Refspec: $GERRIT_REFSPEC 
Branches to build: $GERRIT_BRANCH 
Build trigger: Gerrit event 
Trigger on: patch set created 
Gerrit project: added project and branch

下面是构建输出消息

Triggered by Gerrit: http://ci-test1/22
Building on master in workspace /var/lib/jenkins/jobs/Build_Adserver_4.7/workspace
Checkout:workspace / /var/lib/jenkins/jobs/Build_Adserver_4.7/workspace - hudson.remoting.LocalChannel@733aee56
Using strategy: Default
Last Built Revision: Revision 701a75ef38aa191ac1b806c48e6b3451671888f6 (ads/4.7)
Fetching changes from 1 remote Git repository
Fetching upstream changes from abc
Commencing build of Revision 701a75ef38aa191ac1b806c48e6b3451671888f6 (ads/4.7)
Checking out Revision 701a75ef38aa191ac1b806c48e6b3451671888f6 (ads/4.7)
[workspace] $ /bin/sh -xe /tmp/hudson1375188638196718521.sh
+ echo 'Started Build'
Started Build
+ echo ..................
..................
+ echo 'Build Finished'
Build Finished
Finished: SUCCESS

这里701a75ef38aa191ac1b806c48e6b3451671888f6是repo分支的HEAD,8cbda558adcad4fb7eb714e0b3fb98a6fbf5811c是我最新更改触发的SHA-id.

Here 701a75ef38aa191ac1b806c48e6b3451671888f6 is HEAD of repo branch and 8cbda558adcad4fb7eb714e0b3fb98a6fbf5811c is the SHA-id of my latest change trigged the build.

我也从jenkins工作区进行了验证,其中不包括我的更改.

I verified from jenkins workspace also, it doesn't include my change.

很抱歉,如果我缺少任何要提的信息.请告诉我如果我在这里缺少任何东西,请帮助我.

sorry if I am missing any information to mention. Please let me knowplease help me if I am missing anything here.

推荐答案

您必须将Choosing Strategy更改为Gerrit Trigger

转到作业的配置页面,然后单击git部分下的第二个Advanced按钮.几乎在底部有一个Choosing Strategy,您需要将其更改为Gerrit Trigger

Go to the configuration page of your job and then click on the 2nd Advanced button under the git section. Almost at the bottom there is a Choosing Strategy that you will need to change to Gerrit Trigger

这将导致Git为您的构建获取正确的版本

This will cause Git to fetch the correct version for your build

这篇关于Jenkins Gerrit触发器在构建时未获取我的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 02:21