I am working to create webhook which any git push from Bitbucket will trigger Jenkin job to run on a Linux host (without plugin).
In jenkins, I created a simple pipeline, and came up with this webhook URL.
http://admin:apiToken@www.myjenkins.com:8080/job/job123/build?token=xxxxxx
I tested to run this webhook URL on CLI, it worked and I could see new job fired up successfully in Jenkins Portal.
$ curl -s --show-error http://admin:apiToken@www.myjenkins.com:8080/job/job123/build?token=xxxxxx
However, this URL is NOT working in Bitbucket's webhook setting (project > repo > repo settings > webhooks ) . I clicked 'test connection' it returned 403
with the following error response
Authentication required
<!--
You are authenticated as: anonymous
Groups that you are in:
Permission you need to have (but didn't): hudson.model.Hudson.Read
... which is implied by: hudson.security.Permission.GenericRead
... which is implied by: hudson.model.Hudson.Administer
-->
I used admin
account but it said 'anonymous`.
I also tested git push
and nothing happened in Jenkins.
According to the error response, Looks like it related to authentication issue... but it was weird, command line with curl
was working fine. That means:
- authentication with admin token is fine.
- resource URL is correct.
But the same doesn't work in Bitbucket.
Finally, I tested to enable anonymous account in Jenkins, the Bitbucket could trigger build to Jenkins but too risky. Does anyone have idea on my problem? Thanks