gerrit jenkins trigger and handling of WIP changes of gerrit 2.15

391 views
Skip to first unread message

Andreas Lederer

unread,
Jul 4, 2018, 3:08:52 AM7/4/18
to Repo and Gerrit Discussion
Hi,

I know I should ask in Jenkins groups, but maybe this is also known here:

Does someone use gerrit 2.15 and WIP changes together with the "Gerrit trigger" in jenkins?

I found the following "https://issues.jenkins-ci.org/browse/JENKINS-50547", is there already a workaround, so that jenkins is triggered when a WIP is changed to "Ready for review" ?

Regards,
Andreas

David Pursehouse

unread,
Jul 4, 2018, 3:22:30 AM7/4/18
to Andreas Lederer, Repo and Gerrit Discussion
As long as the handling of the "WIP status changed" event is not implemented in the Jenkins plugin, it's not going to trigger on the transition.  The only workaround I can think is to run builds based on polling rather than triggering.

 
Regards,
Andreas

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Webber

unread,
Jul 4, 2018, 4:20:42 AM7/4/18
to Repo and Gerrit Discussion
On Wednesday, 4 July 2018 08:08:52 UTC+1, Andreas Lederer wrote:
Does someone use gerrit 2.15 and WIP changes together with the "Gerrit trigger" in jenkins?
I found the following "https://issues.jenkins-ci.org/browse/JENKINS-50547", is there already a workaround, so that jenkins is triggered when a WIP is changed to "Ready for review" ?

I opened that ticket. Nothing has been done on it as far as I know.

What we do is have a Jenkins trigger job, which checks to see whether the change is a WIP. If it's not, then it triggers a job that is the "real" test job. The test is really simple:

# check that the change is not a WIP change. If it is, we don't trigger the test job.
rowCount
=$(ssh -p 29418 gerrit.example.com gerrit query --format=TEXT -- change:${GERRIT_CHANGE_NUMBER} is:open -is:wip | grep "rowCount: ")
if [[ ${rowCount} = "rowCount: 0" ]]; then
   
# is a WIP, so don't run
   TRIGGER_TEST
=false
elif [[ ${rowCount} = "rowCount: 1" ]]; then
   
# is not a WIP, so do run
   TRIGGER_TEST
=true
else
   echo
"ERROR getting status of change ${GERRIT_CHANGE_NUMBER} - got \"${rowCount}\" - exiting"
   
exit 1
fi
echo
"TRIGGER_TEST=${TRIGGER_TEST}" >> ${WORKSPACE}/parsed_jobname_and_parameters.properties

Note that some of that is specific to our environment.
Note also that this does not detect when a change is moved from WIP to Ready for Review - for that, our developers currently trigger the test job manually.

I'm not a java person, but I imagine that updating the Jenkins plugin for 2.15 should be straightforward.

Hope that helps
Matthew 

Reply all
Reply to author
Forward
0 new messages