Jenkins Query and Trigger Gerrit Patches - jenkins

I am using Jenkins 'Gerrit Trigger' to configure if there is any patchset uploaded to Gerrit server, then the Jenkins job will be triggered.
But unfortunately, there is some issue that some of the patchsets are not being triggered. I tried to use Jenkins 'Query and Trigger Gerrit Patches' to get those missed patchsets that are not being triggered. And I select one by one to trigger those patchsets manually.
I would like to ask is there any automated way to get those missed patchsets query and run some command to trigger the Jenkins job to run??

As you are able to use the 'Query and Trigger Gerrit Patches' in Jenkins,
it suggests the problem is related to disconnects or some load on the Jenkins-side
that causes it to miss those triggers.
I suggest reviewing the Jenkins-log, looking for errors related to the Gerrit Trigger.

Related

Can I get the build info of the build which retriggerd the current job?

I have a job hooked to a gerrit server.
I've also got the gerrit trigger plugin installed.
When I press "retrigger"/"retrigger all", I want the retriggered job to get the build number of the job which retriggered it.
Any ideas on how to do this?
Thanks
If you retrigger a job if you check in the JOB info, you will see jenkins track that. This is one way: https://medium.com/faun/how-to-get-jenkins-build-job-details-b8c918087030

How to trigger multiple builds on a gerrit commit?

I have gerrit project integrated with Jenkins Server.
When i push a commit into gerrit then a jenkins build is triggered for windows OS(configured parameter) only. Now i want the gerrit to trigger a build on linux OS as well.
So how do we configure such that a commit into gerrit triggers two builds one on Windows OS and the other one on Linux OS ?
Could anyone suggest on how to achieve this ?
You should set the Gerrit trigger pulugin in your job in Jenkins. You can read more detail on this link: https://wiki.jenkins.io/display/JENKINS/Gerrit+Trigger
Actually this plugin checks the Gerrit events so you can trigger many job with one commit. I use this Plugin to trigger more jobs in Jenkins and it works as expected.

gerrit-trigger is not triggering jenkins job based on the comment posted to patchset

Jenkins Version: 2.73.1
Gerrit-Trigger plug-in version: 2.27.1
Gerrit Version: 2.14.2
my scenario here is:
New patch set triggers job 1, job1 posts a message (build first) to that patch set, then job2 should be triggered by that comment, but job2 is not triggered for some reason. Below is the configuration of job 1 and job 2
Job 1 Configuration in Gerrit events:
Job 2 Configuration in Gerrit Trigger >> Trigger on
After job 1 executed successfully, this should send a custom message (build first) to patch set and job 2 should trigger based on the message.
Job 2 is not triggering in this case. Don't know what wrong here.
This is not a complete solution as I believe there may be another way to reproduce the issue but we discovered that we can reproduce this issue if we enable the 3 checkboxes:
Build Current Patches Only
Abort new patch sets
Abort manual patch sets
By disabling these settings Jenkins will no longer abort old job builds if a newer patch is available but it will allow Gerrit Trigger to respond to it's own Gerrit Comments thus triggering additional builds.
We have another system we deployed that experiences this issue but even disabling those 3 checkboxes did not resolve it for that system. I feel like certain settings configurations may cause Gerrit Trigger to ignore it's own comments thus not allowing you to create a job that triggers another job by modifying the success/fail messages of the first job.
I ran into this issue recently with Jenkins 2.235.1 talking to gerrit 2.16.9
I found an option in Jenkins
Jenkins->Manage Jenkins->Gerrit Trigger
Edit Gerrit Instance
Click Advanced
Ensure "Trigger on all comments, even default users" is enabled
Not sure if this was added to address the issue documented here or not but it fixed my issue after enabling this and rebooting jenkins.

How to trigger a Jenkins build on a Perforce submit

I am using Jenkins with Perforce. I have downloaded the P4 Plugin, and I have read over the documentation but I am still a bit confused. In my Jenkins project, I have the build trigger set to "Perforce triggered build". I'm assuming that means I need to add a trigger to Perforce that tells Jenkins to run a build, but I have no idea on how to do that.
I have not been able to find any documentation on how to implement a trigger from Perforce to notify Jenkins it needs to run. I can find documentation from Perforce on how to setup basic triggers, but I can not find anything from Jenkins on how to set up the actual connection to trigger builds on Perforce submits.
On the "Changes" tab in Jenkins, I am able to see the what was submitted to Perforce, so I know that Perforce and Jenkins are at least communicating. Initially, I thought that Jenkins would just automatically run the build on a Perforce submit, if I had "Perforce triggered build" checked, but that doesn't seem to be the case.
So my questions are:
Am I correct in assuming that I need to manually create a trigger to be added to Perforce?
If so, does anyone know of any documentation or examples that I can look to as a guide?
Yes, you need to add a trigger to Perforce. It's well documented here.

Jenkins doesn't trigger job on gerrit event

I cant figure out how to setup gerrit trigger plugin.
Manual build start builds current repo correctly. Test gerrit plugin connection is "Success".
Gerrit is configured according to plugin description article: https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger
Jenkins is 1.635; Gerrit trigger is 2.17.2. Gerrit is v2.11.3
Also tried "Type: plain. Pattern: project1, branches: */base/**" gerrit project settings. didnt work.
Gerrit trigger plugin global config:
Gerrit trigger plugin global config expanded (it has serveradmin user on the picture but i tried user created for jenkins as well):
Job settings:
Probably I'm missing something. Is there a way to figure out what's wrong? Maybe some console commands to figure out if gerrit jenkins user can reach the stream & plugin log?
It seems you need to update Gerrit to the last version and give the good "Access Right" to your Jenkins user.
Follow this set up

Resources