Repository navigation
Implement Bitbucket Server provider - #67
Conversation
|
Thanks for the PR @ChrisTitos ! Please run the tests locally on your mac, via: Linter issues found: |
|
Done :) |
|
Thanks for the update & sorry for the delay @ChrisTitos ; I'll try to review this ASAP! :) |
viktorbenei
left a comment
There was a problem hiding this comment.
LGTM, seems like a "good start" ;)
|
Huge thanks @ChrisTitos for the PR! :) Just curious, did you try to run the server locally on your Mac/PC or on your own Heroku? It helps a lot with debugging :) |
|
I also added you to the "Contributors" section, I hope you don't mind (if you would, just let me know!) ;) https://github.com/bitrise-io/bitrise-webhooks/pull/68/files |
|
Update: release went out, it's in production now on https://hooks.bitrise.io/ ;) |
|
Thanks for merging. It seems to be working in our pipeline :) I first made the test cases, and then I ran the server locally, and manually made the HTTP request with postman to my local server. The difficulty was more finding out what exactly what the Bitbucket payload was for the different event types |
|
Got it, thanks for the infos @ChrisTitos ! :) There's probably only one this which could be improved, the Pull Request handling / build. Does PR work too? I think it should if the PR is from the same repository (not from a fork), as at https://github.com/bitrise-io/bitrise-webhooks/pull/67/files#diff-aa6666f77f055f632dd806bda0f58f1dR198 you specify the PR ID and two branches, but not the "Pull Request Repository" ( ). This should be enough to do a "pull request build" from a single repo (when both the source & the target are in the same repo, not in a fork) but definitely won't work if the PR is coming from a fork. That said I'm not sure how frequent it is to use forks in a self hosted Bitbucket Server environment.(Tech note about PR builds: PR builds are meant to test a "pre-merged" code, the state of the code which would be the result if you'd click "merge" on the PR, to provide a more complete test, compared to just simply testing the PRs branch (e.g. feature/a) which might pass tests in itself but might not (in rare cases) after merging it into e.g. "master"). |
|
In any case huge thanks again @ChrisTitos for your PR & contrib! ;) |
* upstream/master: Update README.md (bitrise-io#68) v1.1.38 Implement Bitbucket Server provider (bitrise-io#67) v1.1.37 Bitbucket v2: return default value when attempt number header is missing (bitrise-io#66) v1.1.36 README: note about the new 200 http status code in case of build could not be started Respond with 200 if build was not triggered of known reason (bitrise-io#64) v1.1.35 migration to new Gopkg.toml based Heroku def (bitrise-io#63) v1.1.34 Update assembla webhook (bitrise-io#62)
New Pull Request Checklist
go fmton your files (e.g.go fmt ./service/common.go, or on the wholeservicefolder:go fmt ./service/...)An example, if you'd write a comment like "Given X this function will return Y" or
"Beware, if the input is X this function will return Y" then you should implement this as
a unit test, instead of writing it as a comment.
README.mdand change/add the descriptions there - alsofeel free to add yourself as a contributor if you implement support for a new service ;)
bitrise run testwith the Bitrise CLI,to perform all the automatic checks (which will run on your Pull Request when you open it).
Summary of Pull Request
To continue with #65 and #66 , I had some time to simply add a dedicated Bitbucket Server provider, as the webhook payloads of Server and Cloud are (still) completely different.
I used the bitbucket-v2 code and tests as a base for this (as I have no prior Go experience).
The events that are supported are:
repo:refs_changed, which include pushes and tag creationpr:opened, Pull Request opened