LoginSignup
8
8

More than 5 years have passed since last update.

Engine Yard Cloud へデプロイした事を HipChat へ通知したい!

Posted at

以下のように、デプロイをフックするスクリプトを用意して、リポジトリに commit & push しておくだけです。

  • AUTH_TOKENROOM_ID は自分の環境に合わせて変更して下さい。
/deploy/after_restart.rb
require 'open-uri'

auth_token = 'AUTH_TOKEN'
room_id    = 'ROOM_ID'
from       = 'Engine Yard'
color      = 'purple'
notify     = 1
message    = "#{deployed_by} deployed a new version of #{app}: #{environment_name} (#{revision[0...6]})."

`curl -d "auth_token=#{auth_token}&room_id=#{room_id}&from=#{from}&color=#{color}&notify=#{notify}&message=#{message}" https://api.hipchat.com/v1/rooms/message`

利用可能な変数

スクリプトで利用可能な変数一覧は、以下のページに掲載されているので、
通知するメッセージは自由にカスタマイズする事が可能です。

HipChat の通知 API

API の詳細は、以下のページに掲載されています。

あわせて読みたい

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8