HipChat Notifications for ember-cli-deploy
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
addon
app
config
lib
node-tests/unit
tests
vendor
.bowerrc
.editorconfig
.ember-cli
.eslintrc.js
.gitignore
.jshintrc
.npmignore
.travis.yml
.watchmanconfig
CHANGELOG.md
LICENSE.md
README.md
ember-cli-build.js
index.js
package.json
testem.js
yarn.lock

README.md

ember-cli-deploy-hipchat Build Status

An ember-cli-deploy-plugin for sending deployment messages to HipChat.


**WARNING: This plugin is only compatible with ember-cli-deploy versions >= 0.5.0**

What is an ember-cli-deploy plugin?

A plugin is an addon that can be executed as a part of the ember-cli-deploy pipeline. A plugin will implement one or more of the ember-cli-deploy's pipeline hooks.

For more information on what plugins are and how they work, please refer to the Plugin Documentation.

Quick Start

To get up and running quickly, do the following:

  • Install this plugin
$ ember install ember-cli-deploy-hipchat
  • Create an authToken in HipChat with the Send Notification permission.

  • Create a roomNotifyToken in HipChat. You can generate one by going to HipChat.com > Rooms tab > Click the room you want > Tokens on the left-hand side > generate a new token with the Send Notification scope.

  • Identify the Room API ID. You can identify this by going to HipChat.com > Rooms tab > Click the room you want > Summary on the left-hand side > API ID in the table.

  • Place the following configuration into config/deploy.js

ENV.hipchat = {
  authToken:       '<your-authToken>',
  roomNotifyToken: '<your-roomNotifyToken>',
  room:            '<your-roomId>'
}

If you use a custom HipChat domain, include it in the configuration.

ENV.hipchat = {
  authToken:       '<your-authToken>',
  roomNotifyToken: '<your-roomNotifyToken>',
  room:            '<your-roomId>',
  endpoint:        '<your-custom-endpoint>'
}
  • Run the pipeline
$ ember deploy

ember-cli-deploy Hooks Implemented

For detailed information on what plugin hooks are and how they work, please refer to the Plugin Documentation.

  • configure
  • willDeploy
  • willBuild
  • build
  • didBuild
  • willUpload
  • upload
  • didUpload
  • willActivate
  • activate
  • didActivate
  • displayRevisions
  • didDeploy
  • didFail

Configuration Options

For detailed information on how configuration of plugins works, please refer to the Plugin Documentation.

###authToken

The authToken to use to auth with HipChat.

###roomNotifyToken

A token for the room you want to notify in HipChat. You can generate one by going to HipChat.com > Rooms tab > Click the room you want > Tokens on the left-hand side > generate a new token with the Send Notification scope.

###room

The Room API ID. You can identify this by going to HipChat.com > Rooms tab > Click the room you want > Summary on the left-hand side > API ID in the table. You (supposedly) can also use the room name, but the ID is safer.

###endpoint (optional)

If you host your own HipChat server, enter the API V2 endpoint for your setup.

Customization

ember-cli-deploy-hipchat will send default messages on the didDeploy-, didActivate- and didFail-hooks on the pipeline. Because every team is different and people tend to customize their automatic hipchat notifications messages can be customized.

To customize a message you simply add a function to your hipchat configuration options that is named the same as the hook notification you want to customize:

ENV.hipchat = {
  authToken:       '<your-authToken>',
  roomNotifyToken: '<your-roomNotifyToken>',
  room:            '<your-roomId>',
  didDeploy: function(context) {
    return function(hipchat) {
      return hipchat.notify('w00t I can haz customizations!', 'yellow');
    };
  }
}

Notification hooks will be passed the deployment context and the hipchatNotifier utility class. The HipchatNotifier uses hipchatter under the hood so you can use its notify-function accordingly.

If you would like to send options beyond message and color (message_type, for example), you can pass options:

didDeploy: function(context) {
  return function(hipchat) {
  	return hipchat.notify({
  	  message: 'what is up @all',
  	  color: 'purple',
  	  message_type: 'text'
  	});
  }
}

Because of the way ember-cli-deploy merges return values of hooks back into the deployment context, you can easily add custom properties to the deployment context if that's what you need to do:

ENV.hipchat = {
  authToken:       '<your-authToken>',
  roomNotifyToken: '<your-roomNotifyToken>',
  room:            '<your-roomId>',

  didDeploy: function(context) {
    return function(hipchat) {
      var myCustomLogic = something;
      var message = "I deployed with " + myCustomLogic + " extra info!";

      return hipchat.notify(message, 'green');
    };
  }
}

Running Tests

  • npm test