I created a webhook in bitbucket server to trigger jenkins job automatically when change pushed into bitbucket.i have done this with bitbucket plugin and generic webhook trigger plugin but its not trigger the job.
i didnt enable "bitbucket server webhook to jenkins" in bitbucket post receive hooks and its showing that it cost 10$.Is it is the issue with this?
Is there any way to trigger without that add-on?
Hey Vishwanath,
I had the same issue once. In my case the bitbucket server was in a private network and the jenkins server in a public one. This stopped the webhook besides the correct configuration.
Could this be your problem too?
With kind regards,
Mario
Hi Mario Carabelli,
Thank you for your suggestion.But is it trigger job within same network without buying that add-on in post receive hooks-"bitbucket server webhook to jenkins"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay then your case is different.
For a basic trigger you should be fine with the native bitbucket and without the plug-in. Since v5. 0 bitbucket has webhooks built in.
But if you use the interface of the plug-in and the functionality of it is disabled this can of course be the reason for your hook not triggering.
Here is the documentation on how to use bitbucket native weghooks:
Best of luck!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the same blog without using any plugin in bitbucket. I created webhook with slash in ending and its showing status 200 but build is not triggered in jenkins. I am not understanding whats the issue with this?
And one more thing if bitbucket is in private network and jenkins in public network, is it trigger build or not?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @[deleted]
To be totally honest I am lost there too. Maybe the jenkins user specified in the hook does not have the necessary permission to trigger the build?
I mean as far as I understand it if you get 200 back the http request was send successfully. This would mean the problem lies most likely in the jenkins config or the form of the webhook url.
If you have bitbucket in a private network it can't send requests to servers outside of the network. This means the trigger in bitbucket is triggered but the request will return 404.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
The user specified in URL has all the permissions i.e admin and i tried with my personal bitbucket its triggering and everything works fine.But here i'm working with bitbucket server v5.10.0. In this version, its showing this problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Its working fine with generic webhook trigger.
Now i want to trigger build only when tag is pushed so I followed the blog:
Its triggering for both commits and tags. But i want to trigger build only when tag is pushed not for commits.
Is it possible?
please help me with this issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@[deleted],
It doesn't seem like this could be done with just the Generic Webhook Trigger plugin alone. The event payloads for Bitbucket Server do not contain information about tags. See the Push event payload on this page: https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html.
One alternative you could do is to allow the job to build after the commit is pushed, but check for the tag early in the build. To do this, make a HTTP GET request to the server (e.g. a curl command). I think the REST API for tags might be useful for your case: https://docs.atlassian.com/bitbucket-server/rest/6.1.2/bitbucket-rest.html#idp317. This will give you a list of tags on a repository. Compare the latestCommit value with the commit id that triggered the build (retrieved by the Generic Webhook Trigger plugin). If a match is found, continue with the build. When a match is not found, that means that the job was not triggered by a tag push and the job should stop.
It may not solve your problem exactly the way you hope it would, but it might be a satisfactory workaround.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.