Ask Your Question
1

Puppet Enterprise Code Manager + Atlassian Bitbucket Server (Formerly Stash)

asked 2016-05-27 13:23:29 -0500

Keiran gravatar image

Hey Everyone,

I'm looking to integrate Code Manager with Atlassian BitBucket Server (Formerly Stash).

This works fine on the publicly hosted BitBucket platform with the out of the box webhooks it provides, however the on premise Bitbucket platform seems to be quite a bit different, specifically in that there are a few webhook plugins available and none are the same as the publicly hosted Bitbucket options (ie, different functionality and JSON POST payload)

The Code Manager documentation says that Stash is supported, however it does not mention what webhook plugin it is leveraging.

Does anyone have this setup and working ? If so, what plugin do you use ?

Thanks in advance,

K

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
2

answered 2016-05-29 08:51:21 -0500

smbambling gravatar image

We use a custom post-receive hook that can be dropped in the post-receive.d of any repository.

This one uses what web hook API that does not require a RBAC token but also doesn't not allow you to wait for a response from the code deployer to verify that your new environment was created or the current environment updated.

NOTE: that the web hook endpoint is set to stash for BitBucker Server per the docs

https://gist.github.com/smbambling/73...

This second one is a little more robust, it will hit the code-manager deploy endpoint and provided a required RBAC token to trigger the code-manager run for a specific environment. It also contains logic to not only wait for the http response code, but get the json response from the code-deployer and will return an error status to both the user that was pushed the new data and report to a slack channel so that other can assist and be aware that one of the environments is in a 'broken' state. I have stripped out of of the logic as we run multiple Master of Masters and need to determine the token to use based on the response given back from a CNAME, but it should still function without any issue

https://gist.github.com/smbambling/e3...

edit flag offensive delete link more
0

answered 2016-06-01 09:24:21 -0500

Keiran gravatar image

Thanks for your feedback on this.

Unfortunately I'm unable to make changes on the bitbucket/stash side to enable this functionality as its a client run platform, What i have done in the meantime is write a quick set of webhook listeners that works with one of the common webhook plugins for stash and it appears to work OK.

I'll get it up to github once i've given it a cleanup if anyone else wants to use it.

Thanks again.

K

edit flag offensive delete link more

Comments

Hi Keiran, which common webhook plugin do you listen to? Can you share your github link?

bingshiao gravatar imagebingshiao ( 2016-07-13 17:40:05 -0500 )edit
0

answered 2017-01-16 09:20:28 -0500

I to have the same issue with PE and Bitbucket server. I am using the 'Http Request Post Receive Hook' which is available on our server. When making a change to the repository I can see the puppetserver.log showing an authenticated codemanger connection. Unfortunately there is no more information logged and the environment is not updated.

I have run through all of the troubleshooting and verified that the code manager and r10k etc are all working. When running code manager deploy through curl I do get the following error

{"kind": "not-found", "msg": "The requested code-manager resource was not found", "details": null}

Any further details on the webhook details to enable this to work would be appreciated.

Thanks

James

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-05-27 13:23:29 -0500

Seen: 217 times

Last updated: Jun 01 '16