Giter VIP home page Giter VIP logo

ember-cli-deploy-hipchat's Introduction

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

ember-cli-deploy-hipchat's People

Contributors

blimmer avatar spencer516 avatar oscarni avatar ember-tomster avatar

Stargazers

Andrey Vystavkin avatar  avatar

Watchers

 avatar  avatar

Forkers

spencer516

ember-cli-deploy-hipchat's Issues

Deployment fails when Hipchat API is down

โ€บ ember deploy staging
version: 2.4.2
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/user-guide/#watchman for more info.
- Listing revisions for key: `my-app:index`
Deploying [============๐Ÿš€ -] 94% [plugin: hipchat -> didDeploy]Error: HipChat API Error.
Error: HipChat API Error.
    at requestCallback (/Users/blimmer/code/my-app/node_modules/ember-cli-deploy-hipchat/node_modules/hipchatter/hipchatter.js:323:35)
    at ClientRequest.<anonymous> (/Users/blimmer/code/my-app/node_modules/ember-cli-deploy-hipchat/node_modules/hipchatter/node_modules/needle/lib/needle.js:293:21)
    at ClientRequest.emit (events.js:107:17)
    at TLSSocket.socketCloseListener (_http_client.js:247:9)
    at TLSSocket.emit (events.js:129:20)
Deploying [=============๐Ÿš€ ] 100% [plugin: hipchat -> didFail]
Pipeline aborted

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.