Giter Club home page Giter Club logo

bitrocket's Introduction

Bitrocket Logo

BitRocket


Overview | Features | Installation | Team | Copyright & License



Overview

Connect Alassian BitBucket Server or Alassian BitBucket Cloud with Rocket.Chat and send notifications to users or channels on each push, pull requests or comments on pull requests to any branch.



Features

This script uses BitBuckets Post-Receive WebHooks to submit a payload to your Rocket.Chat intance, which parses the payload and then posts a message containing differen information.




Installation

Download code

Download source from here.
Unzip Sources.


Configure Rocket.Chat

Add user (optional)

This step is optional if you've already got a user which you want to use as post author you can skip this step.
Otherwise add a new user who is posting the updates to your channel or who ist texting the user which is supposed to be informed.

Configure incoming Webhook in Rocket.Chat

In your Rocket.Chat instance go to administration panel an click on "Integrations". To add an integration with BitRocket click on "NEW INTEGRATION".
Next, choose "Incoming WebHook".
Now, on the webhook config screen, set the following values:

Enabled

Set this value to true

Name (optional)

Enter the desired name for the integration (e.g. "BitRocket").

Post to Channel

Self-explaining option. Insert the desired channel or user which receives the post on pushing to your repositories.
An example user would be @username, an example channel would be #channelname.

Post as

Here you've got to define the user who is posting the updates. This is the user you've created earlier.

Script Enabled

Set this setting to true.

BitBucket Cloud Script

When using BitBucket Cloud you have to insert the complete code of the file BBCloud__POSTReceiveHook.js into this field.

Configure Messages:

Define which links in pull request notification should be shown

const showLinks = {
    decline: true,
    approve: true,
    merge: true,
    commits: true,
    comments: true
};



Now set, which notification you want to receive in Rocket.Chat

const showNotifications = {
    push: true,
    fork: true,
    comment: true,
    pullrequest_created: true,
    pullrequest_declined: true,
    pullrequest_merged: true,
    pullrequest_updated: true,
    pullrequest_comment_created: true,
    pullrequest_comment_deleted: true,
    pullrequest_comment_updated: true
};





BitBucket Server Script

When using BitBucket Server you have to insert the complete code of the file BBServer_POSTReceiveHook.js into this field.

Save changes

Now click on "SAVE CHANGES" to get the required information (it is possible that you'll receive an empty error message below the "Script" option - just ignore it).



Configure BitBucket Cloud

Create Post-Receive WebHook in repository

Navigate to the desired repository and click on "Settings" in the left column.
Now click on "Webhooks" and then on "Add webhook".
The opening page provides an input field for defining your webhook title and your webhook url.
Please enter the correct url to your Rocket.Chat webhook (just copy it from Rocket.Chat integration settings).
On the "Triggers"-option select "Choose from a full list of triggers". In the following list check "Repository -> Push" and every option below "Pull Request"
You can select everything here and overwrite this settings in the script-config directly inside of Rocket.Chat.

Supported triggers
  • Repository Events
    • Push
    • Fork
    • Commit Comment Created
    • Commit Status Created (Example payload needed)
    • Commit Status Updated (Example payload needed)
  • Issue Events
    • Created (Example payload needed)
    • Updated (Example payload needed)
    • Comment Created (Example payload needed)
  • Pull Request Events
    • Created
    • Updated
    • Approved (BitBucket provides too less info)
    • Approval Removed (BitBucket provides too less info)
    • Merged
    • Declined
    • Comment Created
    • Comment Updated
    • Comment Deleted

Click on "Save" and your done!



Configure BitBucket Server

Install Post-Receive Webhook plugin

If it's not installed yet, you need to install the free BitBucket Server Web Post Hooks Plugin.
To install the plugin login to your BitBucket Server instance an navigate to Administration and there click on "Find new add-ons" under section ADD-ONS.
Search for BitBucket Server Web Post Hooks Plugin and click on install.

Create Post-Receive WebHook in repository

Once the BitBucket Server Web Post Hooks Plugin is installed, navigate to the desired repository and click on "Settings" in the left column.
Now click on "Hooks" and enable "Post-Receive WebHooks".
After enabling "Post-Receive WebHooks" klick on the little pen-icon next to the plugin title. The opening modal provides an input field for defining your webhook url.
Please enter the correct url to your Rocket.Chat webhook (just copy it from Rocket.Chat integration settings).
Click on "Save" and your done!



Test connection

To test wether communication between Bitbuket and Rocket.Chat works or not, just push any changes to the repository you've set up the hook.
Did your channel or user receive a notification about the push? Congrats - everything is fine!
No message received? Please double check all steps. If everything is set up as mentioned in this how to and it still doesn't work, feel free to drop us a line!



Add more repositories

To inform your Rocket.Chat channel or user about changes on other repositories, just follow the instructions on how to create the Post-Receive WebHook in BitBucket Cloud/Server again. You're not limited in the number of repositories which send information to Rocket.Chat.



Want to contribute?

If you have any ideas on how to make this script way better, feel free to contact us. We would love to add more features. Let's improve this work together!



Team

Manuel Bachl ([email protected])
Thies Schneider ([email protected])



Copyright & License

Finndrop Studios
Copyright (c) 2016 โ€žFinndrop Studiosโ€œ

Licensed under the MIT license.

bitrocket's People

Contributors

patrickpl avatar rukenshia avatar timhagn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.