LoginSignup
7
7

More than 5 years have passed since last update.

Wercker | ビルド結果を Slack に通知する #wercker #slack

Posted at

Wercker | ビルド結果を Slack に通知する

概要

Wercker のビルド結果を Slack に通知します

手順

wercker.yml の編集

  • after-steps: を追加する
box: wercker/ruby
build:
    steps:
        - bundle-install
    after-steps:
        - sherzberg/slack-notify:
            subdomain: sub_domain
            token: $SLACK_TOKEN
            username: wercker
            channel: "#wercker"
  • sub_domain に Slack のサブドメインを設定
  • username に 通知アカウントのユーザー名を設定
  • channel に 通知先の channel 名を設定 ※シャープが必要

Slack の Incoming WebHooks を追加

  • Slack にログイン
  • Integrations メニューを選択
  • Incoming WebHooks の Add を選択

wercker_slack0.png

  • Post to Channel に任意の Channel を設定
  • Webhook URL の末尾のトークンをクリップボードにコピーしておく
  • Save Settings を押下

Wercker の管理画面から環境変数 SLACK_TOKEN の設定

  • Wercker にログイン
  • Apps => Settings を開く
  • PIPELINE を追加
    • Environment variable を SLACK_TOKEN に設定
    • Text に Slack の Incoming WebHooks の設定時にコピーしておいたトークンをペースト
    • Protected にチェックをする

wercker_slack1.png

動作確認

  • 対象リポジトリを適当に編集して push
$ git push origin master
  • Slack の wercker Channel で結果の確認

wercker_slack2.png

  • 通知チャットメッセージ中の build リンクを押下すると、 Wercker の該当結果ページに移動

wercker_slack3.png

参照

wercker blog | Slack Notifications!

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