Can't report +1 to gerrit server via jenkins - jenkins

I tried to build CI on my system. The Jenkins could listen gerrit push event and checkout the code. But jenkins Gerrit-Trigger not reporting +1 verified after successful job run.
There is an error message in Console Output: ERROR Gerrit response: HTTP method POST is not supported by this URLFinished: SUCCESS
Versions:
Windows 10
Jenkins 2.263.1
Gerrit 2.10.2
Gerrit Trigger Plugin 2.32.0
Git Plugin 4.5.0
There are some warning, does it matter?
My item Gerrit Reporting Values:
EDIT
The Error message doesn't show again after modifying --message Message to double quotes (Manage Jenkins > Gerrit Trigger > Gerrit Verified Commands)
EDIT

Some things you should consider:
Your Gerrit version is (really) too old, it would be very good if you update to a newer version.
Try to uncheck the "Use REST API" option at Manage Jenkins > Gerrit Trigger > Advanced > REST API. Maybe the Gerrit 2.10.2 REST API isn't compatible with the Gerrit-Trigger last version.
Do you have the "Code-Review" and the "Verified" labels defined on Gerrit? Does the Gerrit user used by Jenkins have permission to perform the review (-1/+1)?

Related

How to make Jira trigger plugin to work in Jenkins?

I'm configuring Jira trigger plugin (https://github.com/jenkinsci/jira-trigger-plugin) in Jenkins:
JIRA Trigger Configuration
We use Jira DC version and already set the webhook up as described in the documentation shared by #ceilfors. The Jenkins job is very simple:
Jenkins Build Triggers configuration
Also configured a Logger to triage any isue:
Configure log recorder
So when I add a comment on a task under project SNDBX I can see Jira is firing the webhook created:
Jira firing the webhook
However in Jenkins nothing happens, I checked "All Jenkins Logs" and I get:
Jenkins logs
And the logger for jira webhook is showing:
Jira Webhook logger
So the we webhook is "reaching" Jenkins somehow.
BTW, I have Jenkins over Java 8 installed:
Jenkins configuration xml file
Already fixed. It was an issue on my Jira server not trusting (SSL cert) Jenkins srvr.

How can I get Jenkins builds to report failures back to Bitbucket server?

My work is running Jenkins and Bitbucket Server (so instead of the bitbucket cloud, they host their own bitbucket version). I am used to having passing/failing builds on github and bitbucket cloud immediately reporting back on PRs and branches as to whether the build passed or failed. I want to give that gift to my team in the current environment. How do I get PRs in Bitbucket server to receive success/failure of builds from Jenkins?
[Figure 1 just shows an example of the functionality I want, operational on PRs in github+codeship]
While the Webhook to Jenkins for Bitbucket can help notify Jenkins to poll whenever there is a commit, you still need to be mindful of the “lazy ref updates” in Bitbucket (described in this thread)
We had to implement something that would do a get to the REST API for the pull-request/*/changes before the call to the Jenkins /git/notifyCommit url.
The last Jenkins URL /git/notifyCommit comes from the Jenkins Git plugin.
See more at "Configuring Webhook To Jenkins for Bitbucket".
Once Jenkins is properly called, you can then, as mentioned in "Notify build status from Jenkins to Bitbucket Server", use the "Jenkins Stash Pullrequest Builder", from nemccarthy/stash-pullrequest-builder-plugin.
The bitbucket server has build-status API. It stores a build-status for particular commit, there is no separate PR build status. The PR build status is a build status of the head commit in this PR.
You can implement yourself the rest api call to update the build status or to use one of the existing plugins. We use Post Webhooks for Bitbucket bitbucket plugin in conjunction with Bitbucket Branch Source jenkins plugin.
You could you use BitBucket REST API to achieve this ?
Here the how-to update commits with the build status :
Updating build status for commits
Commit status are then shown in Pull Request and on branches
you can setup Stash notifier plugin , it workds perfectly with BitBucket and notifies build status to branch and pull request

Bitbucket | Trigger Build on Pull request [duplicate]

This question already has answers here:
How to trigger jenkins build upon bitbucket pull request merged
(2 answers)
Closed 5 years ago.
I have a Jenkins job which I want to trigger when I evaluate a pull request on Bitbucket. The Jenkins job is correctly configured (by the looks of it) with the 'Poll SCM' option checked.
I have setup the 'Bitbucket Server Webhook to Jenkins' as follows. When I click on 'Trigger Jenkins' as part of the configuration check, it works well. Corresponding logs on the Jenkins server show up properly.
Now, when I receive a pull request, I would want to trigger the same Jenkins job. However, which I click on the 'Trigger Build' option, nothing happens. The Jenkins job is not triggered. I dont see correspnding logs on the Jenkins server. No logs on the bitbucket server as well.
Where am I going wrong?
I am using an 'Atlassian Bitbucket v4.7.1' evaluation installation and a Jenkins 1.651 installation.
Just tried bitbucket 4.13 with webhook to jenkins for bitbucket 3.0.1 plugin. Follow the instruction on the plugin site, you need to install the git plugin on the jenkins side, enable git checkout and make sure it works, and enable polling of scm. The jenkins version used is pulled from docker hub with tag jenkins/jenkins:lts.
If the above does not work for you, from my reading you can have a few options as of today Nov 12 of 2017:
Use the generic post webhooks plugin that supports pull request trigger. And from jenkins pick it up with the generic webhooks plugin, then maybe do a secondary trigger from jenkins.
Upgrade the bitbucket server and webhooks to jenkins plugin. The server 4.13 does not work well with later webhooks to jenkins plugin. A paid version of the plugin probably is your best choice.
Or try bamboo that comes with the "plan banches" feature.

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

Jenkins Integration with Jira issue

I have installed Jenkins Plugin for JIRA on my JIRA installation and also JIRA Plugin for Jenkins on to my Jenkins installation. I have added an application link in JIRA settings.
I am facing below issue:
1) On Application Links page there is a warning that my Jenkins Application "seems to be offline". While Adding a jenkins link it gives me error : The host doesn't respond. Change the url or click next to confirm.
Jira Version - 6.0.5
Jenkins Version - 1.562
Jenkins-Jira Plugin Version - 1.4.3
Thanks to anybody who's willing to help me out on this.
You can follow four steps:
Install JIRA Plugin in Jenkins
In Jenkins:
Manage Jenkins > manager plugins > available
search and choose Jenkins JIRA plugin , Jenkins JiraTestResultReporter plugin and Jenkins JIRA Issue Updater
Install Jenkins Plugin in JIRA.
https://marketplace.atlassian.com/plugins/com.marvelution.jira.plugins.jenkins
see: Installation section.
Add Jenkins 's Application Links in JIRA
The integration between JIRA and Jenkins has Application Links as its base. This allows administrators to configure and manage the Jenkins
To get started, go to [JIRA_BASEURL]/plugins/servlet/applinks/listApplicationLinks and click on the Add Application Link button to add a new Application Link for Jenkins.
or administration > plugin > Application Link > add Application Link; do as instruction
note: Optionally, but required if Jenkins is secured,
configure Outgoing Authentication that JIRA should use.
To do this, click on the Edit link next to the Jenkins Application Link, and select OutGoing Authentication tab
Provide the Username of the user to use to authenticate against Jenkins with
Provide the Password of the use
Jenkins Configuration
After the installation of the Jenkins Plugin for JIRA, and the configuration of at-least one Application Link, administrators will be able to control which Jobs are included in the synchronisation process and which aren't.
in Administration > plugins (add-ons) >Jenkins Configuration
Download JIRA plugin for Jenkins and install this plugin in Jenkins
way 1: copy it to Jenkins's plugin folder. and restart Jenkins
way2: Manage Jenkins > manager plugins > advanced > Upload Plugin . Choose file and upload then restart Jenkins
Enable Jenkins job in JIRA
then just use a known JIRA Issue Key in a commit message of your source code repo
Jenkins will make all the change sets (commits) available to the JIRA plugin when syncing a build.
The sync process uses the change sets to look for JIRA Issue Keys. Once this process locates a link, then that build will be available in the CI Build Panels.
download jenkins-jira-plugin at http://mvnrepository.com/artifact/com.marvelution.jira.plugins/jenkins-jira-plugin

Resources