It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bitbucket Server integration with jenkins

Chris Cho Aug 16, 2016

Hi, there.

 

I'm trying to trigger webhook event when my Bitbucket repository got 'push' event. 

The version is.. Bitbucket Server 4.7.1 and Jenkins 2.14 installed version.

 

I tried 2 way.

1> Using Bitbucket Server Webhook to Jenkins

I installed this and try to configure Jenkins URL like this. (I hide my domain address as 'xxxxx')

http://dhdmsvn.corp.doosan.com:18080/bitbucket-hook/

 

I already installed Jenkins Bitbucket plugin and check 'Build when a change is pushed to BitBucket' option for specific repository build trigger.

 

{"message":"Jenkins response: <html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n<title>Error 404 Not Found</title>\n</head>\n<body><h2>HTTP ERROR 404</h2>\n<p>Problem accessing /bitbucket-hook/git/notifyCommit. Reason:\n<pre>    Not Found</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>\n\n</body>\n</html>\n","url":"http://dhdmsvn.corp.doosan.com:18080/bitbucket-hook/git/notifyCommit?url=http%3A%2F%2Fadmin%40dhdmsvn.corp.doosan.com%3A17990%2Fscm%2Fswsvc%2Fplant_care.git","successful":false}

 

It looks like there are version conflict or something. So, I forgive to use it.

 

2> Using normal Webhooks. Add-in name is 'bitbucket-webhooks'

After install this add-ins, I can found new menu on the left pannel, menu name is 'Webhooks'.

So, set Jenkins to allow run from external URL and put like this.

image2016-8-17 10:19:7.png

 

This url include all information to run specific Jenkins job and working correctly when I put this url on my web browser. Jenkins job has triggered.

 

But after push any source in Bitbucket repository, it is not called.

This problem is not associated with Jenkins.

 

Can you give me any advice solve this problem?

 

Best regards,

Chris Cho

 

3 answers

1 accepted

3 votes
Answer accepted
Yogesh Mude[Jira] Aug 16, 2016

HI 

Hi

For triggering build in Jenkins automatically once changes done into Bitbucket SCM you have to install 

"Bitbucket Server Webhook to Jenkins" in Bitbucket ...

If already installed then you have to enable "Post Receive" Hook on that particular repo.

Once you are done this In Jenkins Job you have to add "poll SCM".


2016-08-17_1056.png

2016-08-17_1051.png

hook.png

 


Chris Cho Aug 16, 2016

Can you show the last image configuration?

The 'Bitbucket Server Webhook to Jenkins' configuration is confused..

Like Mikhail likes this
Yogesh Mude[Jira] Aug 16, 2016

Provide the related Jenkins details and you can do that ..

I already configured that things now i can do only Disable/Enable kind of thing as you can see there two tabs are available . smile

Chris Cho Aug 16, 2016

On the last image, you can find pencil icon right side of "Bitbucket Server Webhook to Jenkins".

Can you click it and show me the configuration?

Yogesh Mude[Jira] Aug 16, 2016

see the configurations nothing grate in this ....simply we need to provide our Jenkins related info.....smile

 

2016-08-17_1451.png

 

Chris Cho Aug 21, 2016

Thanks a lot. So, Jenkins URL is just only Jenkins URL.

There are lots of wrong guide to put additional address like../bitbucket/

Now, it is working. Thanks a lot!

Yogesh Mude[Jira] Aug 22, 2016

HI @Chris

If you are satisfied with this answer please Accept this bcz it will helps others to sort out their problems like this. 

Chris Cho Aug 22, 2016

@Yogesh Mude[Jira] Okay, I did it! Thank you for help!!

devops idc Mar 07, 2017

Still not working for me..

Is it the authentication needs to be set between Bitbucket and jenkins before hand?

 

I have Bitbucket in a server and JEnkins in another and I do a http call.Capture1.PNG

Daniel Diaz Jul 12, 2018

@Yogesh Mude[JirI know this is late and you may not remember, but I came across this issue and this solved the problem. Why do I need to "poll SCM" if I've set Bitbucket to notify on changes. Doesn't this defeat the purpose? For now I just set the polling to happen yearly since I really don't want a job to start from random polling events.

0 votes
Green Elephant Oct 04, 2018

You can use plugin https://marketplace.atlassian.com/1219418 for integrate Bitbucket and Jenkins

0 votes
Grace Nov 28, 2018 • edited

go, get:

Bitbucket Branch Source PluginAllows to use Bitbucket Cloud as a source for multi-branch projects. It also provides the required connectors for Bitbucket Cloud Team Folder (also known as repositories auto-discovering). 2.2.15    

  Bitbucket PluginIntegrates with BitBucket

the second is the plugin that you have installed.

The top is the one that will upgrade you plugin.

 

Now under Manage Jenkins --> Configure System --> there will be a: Bitbucket Endpoints ---> add Bitbucket Server ---> Server URL : add the server url... and redo what you were trying to do.. good luck

 

Grace Tshihata: tshihata@outlook.com.... email me if it doesn't work

Grace Nov 28, 2018

when redoing the job configuration... make sure you choose bitbucket

Like Alexey likes this

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

3,236 views 1 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you