HipChat integration with Jenkins - jenkins

I'm trying to add the HipChat plugin to my Jenkins builds, but it doesn't post anything.
In the global configuration I've set the HipChat server to api.hipchat.com, added an API token und default room ID, set the build server URL to https://xxx.ci.cloudbees.com/ and the send as name to Jenkins.
In the build job configuration I've tried setting the same room ID and leaving the field blank (so it should use the default). I've activated all notify checkboxes and added HipChat Notifications as the (only) post-build action.
However, I'm not receiving any build updates in the given room. So I've added a custom Jenkins logger, logging ALL from jenkins.plugins.hipchat. For every build I start, I get a single log entry like this:
Aug 28, 2014 6:08:20 PM INFO jenkins.plugins.hipchat.HipChatNotifier$HipChatJobProperty prebuild
Invoking Started...
Any ideas what I'm doing wrong or how I could debug this further?
PS: I'm running on Cloudbees — not sure if this makes any difference.

The Hipchat notifier plugin for Jenkins uses the HipChat API v1, not the newer API v2. I had the same problem while trying to use a v2 token.
Try creating an admin token in Hipchat for Jenkins (e.g., https://my-hipchat-group.hipchat.com/admin/api) instead of creating a room token (e.g., https://my-hipchat-group.hipchat.com/admin/rooms/tokens/665113).
I was able to get the HipChat API v2 token working with a manually built hpi from the https://github.com/yagince/hipchat-notifier-plugin project.

This seems to have been addressed in the 0.1.9 and newer versions of the hipchat plugin at https://wiki.jenkins-ci.org/display/JENKINS/HipChat+Plugin. I'm using it with a v2 API token.

Related

AzureDevops webhook to jenkins fails on unauthorized access

Recently i've updated jenkins to build 2.346.3 .
Since then Azure Devops webhook configured for triggering a build by the trigger "code push" fails with the following output:
Failed Sent at: Wednesday, October 26, 2022 10:52:13 AM Message Jamal Hartnett pushed updates to Fabrikam-Fiber-Git:master. Error Message Unauthorized (401)
I've tried to reach microsoft support to solve this..... the savior will not come from their side...
I am using a multibranch pipeline in jenkins.
The token is valid... as far as i see from the documents in jenkins their instructions is to use the "token" parameter in the URL but i don't see any "token" parameter in the URL azure devops sending the webhook to.
Any suggestions? .
I've tried to create new tokens , using CURL to see if the webhook works following the instructions in jenkins documentions which was succesfully performed without any error.
I had this same issue. The fix is to update the server setting in the hook configuration in AZDO from https://build.company.com to https://build.company.com/?token=<USERTOKEN>.
The user token is one generated in a Jenkins user's profile section.

Access GitLab Plug-in's API Token from Jenkins Job

I have instances of Jenkins and GitLab which are successfully connected. Part of setting up the GitLab plug-in involves providing an API token. I believe this is used by the plug-in to get details of the commit which is triggering a job.
I need to run a daily Jenkins job which collects some statistics using the API and then (using R) generates a report. So this is not triggered by an event in GitLab.
To complicate issues a little further, the R code will run inside a container (to avoid hving to install R and all the packages on every Jenkins slave),
It does not appear that the plug-in makes the token available to be used in jobs ... and I can see a sane reason for that.
Is it possible to access the API token from the plug-in?
There is a plugin which supports credential injecting (https://wiki.jenkins.io/display/JENKINS/Credentials+Binding+Plugin) to the builds which could be used later as an environment variable. Gitlab api token could be also selected.

Jenkins 2.3.5 Build Notification (Emailext, bitbucket build status notifier) Not Working

We recently rebuilt our Jenkins server and we are using Jenkins 2.3.5/JDK8/ubuntu 14.04/bitbucket cloud/hipchat cloud.
After we got the newly built Jenkins server running, everything worked except for the build result notification.
We used to get the bitbucket account that we used with Jenkins to comment on the build result, so we can receive it in the hipchat room, even without using hipchat notification plugin. Now, we have tried the emailext plugin, Bitbucket Build Status Notifier Plugin, but none of them worked. It seems that the plugin is all out of date in terms of configurations.
For emailext, it complains "An attempt to send an e-mail to empty list of recipients, ignored." But we put a number of email in the "Default Recipients". And all the SMTP settings are correct since we can receive testing message.
For Bitbucket Build Status Notifier Plugin, I followed here, but I couldn't find the "Bitbucket notify build status" in the job configure.
Any suggestions would be appreciated.
Use Extended Email notification plugin, set SMTP server in Jenkins global configuration

VSTS integration with Jenkins

I have created a new Team Project in Visual Team Services with Git as the repository. On this repository I have checked-in a Java project and implemented continuous integration and deployment using Jenkins.
The Jenkins instance is present on an Azure VM created using Azure RM. I have configured polling in the Jenkins build and the build is getting triggered whenever a code change happens to the Java project.
So now our requirement is to use VSTS service hooks instead of polling. So we have created a Jenkins service hook which is configured to call the Jenkins build whenever code gets pushed. Though the Jenkins connectivity is successful, it is not able to call the Jenkins jobs.
It is throwing an error saying "No valid crumb was included in the request (403)". The wizard doesn't allow you to customize the HTTP post request. Is this a product issue or do we need to make any configuration changes to Jenkins instance?
Image 1
Image 2
As answer in Jenkins REST API Create job suggests, the issue is probably caused by CSRF Protection which is enabled by default.
According to this blog article published on 18 Aug 2016 “Jenkins Queue Job” task handles this correctly. Try using that.
The “Jenkins Queue Job” task was initially introduced in July, 2016. The task now has support for parameterized Jenkins jobs and tracks full Jenkins pipelines. It also now supports self-signed server certificates and Jenkins crumb security for protection against cross-site request forgery (CSRF) exploits.

Jenkins Multibranch Pipeline - GitHub Enterprise Issues?

I have spent days troubleshooting/researching this issue. I can't seem to figure out what's going on here. I'm trying to setup a multibranch pipeline project pointed at our internal GitHub enterprise servers. The same issue occurs in other project types too like the "GitHub Organization". It's some sort of security issue that I can't figure out.
Let's start with what I know...
I have (to my knowledge) configured the GitHub Plugin configuration correctly with a TOKEN (also configured per documentation)... I can successfully "Verify Credentials" and it comes back successful. http://imgur.com/br13adk
I keep getting this validation issue on the GitHub Enterprise Servers Validation
http://imgur.com/GnffTeV
I can connect successfully to any ONE repository hosted on my enterprise github server. When I try to configure a multi-branch project from a GitHub source, I ALWAYS get BLANK for repositories....
http://imgur.com/2Q9s1mo
I configured a custom logger to see what was going on and it seems like the branch source plugin is always going out to api.github.com...
Jan 25, 2016 11:48:23 AM WARNING org.jenkinsci.plugins.github_branch_source.Endpoint$DesciptorImpl doCheckApiUri
Jan 25, 2016 11:48:23 AM WARNING org.jenkinsci.plugins.github_branch_source.Endpoint$DesciptorImpl doCheckApiUri
Jan 25, 2016 11:54:58 AM WARNING org.jenkinsci.plugins.github_branch_source.AbstractGitHubSCMSource$AbstractGitHubSCMSourceDescriptor doFillRepositoryItems
Server returned HTTP response code: 401 for URL: https://api.github.com/user
Jan 25, 2016 11:54:58 AM WARNING org.jenkinsci.plugins.github_branch_source.AbstractGitHubSCMSource$AbstractGitHubSCMSourceDescriptor doFillRepositoryItems
Server returned HTTP response code: 401 for URL: https://api.github.com/orgs/nhudacin
Jan 25, 2016 11:54:58 AM WARNING org.jenkinsci.plugins.github_branch_source.AbstractGitHubSCMSource$AbstractGitHubSCMSourceDescriptor doFillRepositoryItems
Server returned HTTP response code: 401 for URL: https://api.github.com/users/nhudacin
I've configured the API endpoint for the GitHub plugin (as seen in the first screen shot), for the PR Builder plugin and the credentials are working (or so it seems). I'm thinkin it's a probably with the enterprise API endpoint configuration.
Any help?? I'm going CRAZY here!
I'm having a similar issue as Nick H.
In my production Jenkins instance
Jenkins version 2.17 Latest weekly release with all plugins up to date as of Aug 10 i.e
GitHub Branch Source Plugin 1.8.1
PipelineMultibranch 2.8
I get :
WARNING: Server returned HTTP response code: -1, message: 'null' for URL: https://api.github.com/users/ORG
Even when I have configured the API endpoint on GitHub Enterprise Servers to be http://github.MYDOMAIN/api/v3/
On the other hand, on a fresh local install of Jenkins
with the same configuration I get:
Aug 11, 2016 3:19:14 PM org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$DescriptorImpl doFillRepositoryItems
WARNING: Exception retrieving the repositories of the owner ORG on with credentials USER/****** ( test credentials)
Edit: I found a way to make it work, it was not very intuitive, I found it after browsing the code and matching the strings to the plugin UI
What you need to do is, after you get the Invalid credentials red error press Advanced... button
Then a combo box with the API endpoints defined in the Manage Jenkins-> Configure System -> GitHub Enterprise Servers will appear.
Select the API endpoint for you GitHub Enterprise instance, choose Checkout credentials that have access to that instance and the list of all the repositories will appear.
Save it, and start a Branch indexing discovering the branches that have a JenkinsFile on it.
NOTE: in order to have this working every push a web hook needs to be installed in github Enterprise, you can do that by going
Manage Jenkins-> Configure System -> GitHub and press the second Advanced... button
Now a Re-register hook for all jobs button will appear. Just press that and it should add the hook that will be triggered every time you push into your matching repos.
Hope this helps
I don't have much knowledge about this particular scenario, but in this commit you can see, that they switched from regex validation to anonymous connection to endpoint. And if your server is in private mode, it will fail.

Resources