Trying to trigger Jenkins build using POST however getting 403 - jenkins

Hi I am trying to connect up a Bitbucket webhook connected to a Jenkins server. I have been able to trigger a job using a GET command using a token, however it seems that Bitbucket uses a POST and so I have found a few answers on here about using the following format:
http://jenkins-username:jenkins-password#jenkins-url:5555/job/job-name/build?crumb=crumb_token.
However, when using this I get an Error 403 No valid crumb was included in the request
I got the crumb value using this:
https://jenkins.xxx.xxx.xxx/crumbIssuer/api/json
I have also tried the "Enable Proxy compatibility" option in my Jenkins server.
Am I missing something?

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.

Artifactory webhook gives "Sending a dummy Webhook failed"

So I have a self hosted Artifactory repository which I wanted to use with a Jenkins pipeline, I deployed Jenkins with ngrok in order to have a fake domain.
When I created the webhook inside Artifactory I used the following URL: https:///generic-webhook-trigger/invoke?token=123**
I tried testing it inside Artifactory and keep getting the error alert "Sending a dummy Webhook failed" and of course, the pipeline not getting triggered
This is the output inside ngrok command, looks like the webhook is getting triggered but ngrok is showing a 404 error
I've been stuck for days and I hope someone here can help me with this.
It seems that the problem is in the webhook service configuration, either in Jenkins or in ngork.
Did you try calling the webhook service directly from curl or postman?
Did you try calling the Jenkins webhook service directly to make sure it is configured correctly?
You may try configuring Artifactory to call Jenkins directly by setting urlStrictPolicy to false in system.yaml.
You can read more about configuring Artifactory webhook in the following article:
https://jfrog.com/knowledge-base/artifactory-how-to-test-webhooks-in-artifactory-and-check-its-request-payload/

Webhook Test fails during jenkins Gitlab integration

I am trying to integrate jenkins with Gitlab for CI such that if push event is happens then build will be triggered. I am using two things to connect. One is Gitlab acess token: I have created project specific access token and added in Jenkins global configuration. Second is SSH primary key: I have added this in my job configuration. Now when I test the webhook I get below error. Can any leads help me to fix it?
Hook executed successfully but returned HTTP 500 <head resURL="/static/861bc558" data-rooturl=""
I will attach full error if needed

BitBucket Webhook gives Crumb issues while posting to Jenkins

I am trying to setup webhook from Bitbucket to Jenkins but it is failing while testing them crumb issues. This Jenkins is deployed to Kubernetes 1.17 and Jenkins is the latest image 2.249.1 . Even from PostMan I am getting the same issue. I know there is something wrong in Jenkins Setup only.
Error :
Error 403 No valid crumb was included in the request
HTTP ERROR 403 No valid crumb was included in the request
Assuming you are triggering the job as a pre-push script, if its throwing crumb errors, you need to create personalized API token within Jenkins and would need that to be embedded in the API call from Bitbucket to Jenkins.
Please refer this article for generating a token - https://support.cloudbees.com/hc/en-us/articles/115003090592-How-to-re-generate-my-Jenkins-user-token

Bitbucket won't trigger Jenkins build on commit when using a POST hook

I'm struggling with getting Bitbucket to POST to Jenkins in order to trigger my tests. I've tried the following without any success:
Bitbucket Jenkins Plugin
Jenkins Hook in Bitbucket
POST Hook in Bitbucket
I'm starting to suspect that the problem may be that I have spaces in the Jenkins job name although I'm not sure if this is actually the problem. The strange thing is that if try the same URI defined as "POST Hook" in Bitbucket from Postman it works! Here's a URI that works from Postman:
http://bitbucket:password#my-jenkins-server:8080/job/Integration%20Tests/build?token=ABCDEF
But it won't work if I paste it as a POST hook in bitbucket:
I've tried removing %20 in case BitBucket URL encodes the URI automatically but without success. Any clues?

Resources