Bitbucket "Discuss that code" and Hipchat Server

Jonas Andersson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 28, 2016

Hi,

I am attempting to set up Bitbucket Server to run the plugin "Discuss that code for Bitbucket Server" against a HipChat Server deployment.

Some versions:

Discuss That Code for Bitbucket Server Version 1.2.2

Atlassian Bitbucket v4.12.0 (server)

Atlassian HipChat 2.1.3 (2016.12.08.212350) OVA (vmware)


The HipChat server and Bitbucket is up and running. I installed the plugin, and the next step is configuring the HipChat v1 Administration token. I attempted to create this under "group admin"->"API"-> select type Admin, gave it a name. (https://HIPCHAT.SERVERNAME.GOES.HERE/admin/api) I then continue to copy this hash to the "Discuss that code"-hook setup on one of the repositories in Bitbucket (on url https://BITBUCKET.SERVERNAME.GOES HERE/projects/PROJECTNAME/repos/dashboard/settings/hooks) as show on the top picture in the documentaion here: https://mibexsoftware.atlassian.net/wiki/display/DTC/Usage


When trying to enable the hook, i get error:

Token not valid: 401: Unauthorized (Auth token invalid. Please see: https://www.hipchat.com/docs/api/auth)

Something i noted: When looking at the link to generate a token, this goes to hipchat.com, not our local HipChat server, making me think the plugin tries to verify the token against the cloud instance rather than our local server.

I also verified that this plugin indeed was for the server version of Bitbucket, not cloud, but i seem to get no further.


Does anyone else manage to make this work?



7 answers

1 accepted

2 votes
Answer accepted
Jonas Andersson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2016

I started with unpacking the dtc-122.jar and recursively searching for hipchat.com, found a few matches.

I added these lines to /etc/hosts (pure guesses):

<IP.TO.OUR.HIPCHAT.SERVER>   www.hipchat.com hipchat.com

And tried again, still claimed the API token was invalid, so I setup a tcpdump session:

root@&lt;MY.FANCY.BITBUCKET.SERVER&gt;:~# tcpdump -vvvv -s5000 -ieth0 | grep hipchat
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 5000 bytes
    BITBUCKET.SERVER.NAME.HERE.33765 &gt; OUR.DNS.SERVER.NAME.HERE.domain: [bad udp cksum 0x6c6f -&gt; 0xab6b!] 17552+ A? api.hipchat.com. (33)
    BITBUCKET.SERVER.NAME.HERE.33765 &gt; OUR.DNS.SERVER.NAME.HERE.domain: [bad udp cksum 0x6c6f -&gt; 0xee2d!] 59085+ AAAA? api.hipchat.com. (33)
    OUR.DNS.SERVER.NAME.HERE.domain &gt; BITBUCKET.SERVER.NAME.HERE.33765: [udp sum ok] 59085 q: AAAA? api.hipchat.com. 0/1/0 ns: hipchat.com. [3m33s] SOA ns-127.awsdns-15.com. awsdns-hostmaster.amazon.com. 2 7200 900 1209600 300 (111)
    OUR.DNS.SERVER.NAME.HERE.domain &gt; BITBUCKET.SERVER.NAME.HERE.33765: [udp sum ok] 17552*- q: A? api.hipchat.com. 3/4/0 api.hipchat.com. [1m] A 52.0.176.89, api.hipchat.com. [1m] A 52.45.32.139, api.hipchat.com. [1m] A 52.54.231.92 ns: hipchat.com. [1h] NS ns-1217.awsdns-24.org., hipchat.com. [1h] NS ns-127.awsdns-15.com., hipchat.com. [1h] NS ns-1947.awsdns-51.co.uk., hipchat.com. [1h] NS ns-867.awsdns-44.net. (218)
^C212 packets captured
214 packets received by filter
0 packets dropped by kernel

Seeing that it was talking to api.hipchat.com, i added this subdomain to the /etc/hosts to.

Turns out the API end-points are the same between Cloud and Server version, it started working smile

I did a handful of attempts to diskediting the ./com/zaneli/escalade/hipchat/HttpExecutor\$class.class which contains the hardcoded references to api.hipchat.com, and repackage the jar but after a few fails i figured that this lame workaround is enough for my proof of concept.

Hope this helps someone else.

Kind regards

 

Jonas

 

1 vote
Arbi Dridi
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 29, 2016

Amazing work, Jonas! Thanks for sharing and Happy New Year!

Jonas Andersson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2016

Thanks Arbi, you too!!

1 vote
Arbi Dridi
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 28, 2016

Hi Jonas, 

I have done a bit of research and came across https://www.pixsoftware.nl/fr_BE/shop/product/36041?category=562

Although the plugin is for Bitbucket Server as you indicated, the plugin vendor mentions: 

Please also note that the add-on currently only supports HipChat cloud and not HipChat server.

So your observation about hipchat.com makes sense. 

Thanks. 

Arbi Dridi
Premier Support Engineer | Atlassian

0 votes
Arbi Dridi
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 29, 2016

Wonderful! If you don't mind, would please share it here for the community? 

Thanks!

0 votes
Jonas Andersson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2016

LOL, just hacked my way around this. Their plugin now works against HipChat Server wink

0 votes
Arbi Dridi
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 29, 2016

Hahaha, thanks Jonas :) Unfortunately, there's not much we can since this is a third party plugin. However, I'm pretty sure you can seek help from Pix Software as I would think adapting it to HipChat Server shouldn't be complex. They certainly know more, though.  

0 votes
Jonas Andersson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2016

Hahhaa Hi Arib, i actually wanted to ask you on our last case, but figured ill hit the vendor and answers before asking you, so funny that you show up here too smile Not the answer i was hoping for but at least an answer.. Thanks mate, upvoted and confirmed as the answer.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events