LoginSignup
7
8

More than 5 years have passed since last update.

Engine Yardにデプロイした際にSlackに通知する。

Posted at

Gemなどもあるが、さほど使いやすくも無かったのでcurlを直接叩いた。

deploy/after_bundle.rb
on_app_master(){
  token = 'put_your_toke_for_incoming_webhook'
  link = 'https://github.com/engineyard/todo/commit/' + config.revision
  icon = ':ghost:'
  run 'curl -X POST --data-urlencode \'payload={"channel": "#tokyo", "username": "' + config.environment_name + '", "text": "@channel ' + config.deployed_by + ' deployed <' + link + '|'+ config.revision[0..7] + '>", "icon_emoji": "'+icon+'"}\' https://railtie.slack.com/services/hooks/incoming-webhook?token=' + token
}

JSONの作成などを綺麗にする余地はあるが動いたので。

7
8
3

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
7
8