LoginSignup
13
18

More than 5 years have passed since last update.

JenkinsとSlack連携

Last updated at Posted at 2019-02-11

JenkinsとSlackを連携して、Jenkinsのビルド結果をSlackに通知させます。

Slack側の設定

ワークスペースにJenkins CIアプリをインストールします。

完了すると、Jenkins側のセットアップの手順が表示されます。
BaseURLとTokenが発行され、Jenkins側の設定で使うのでひかえておきましょう。

Slack側の設定は以上です。

Jenkins側の設定

プラグインで[Slack Notification Plugin]をインストールします。
Jenkinsの管理 > プラグインの管理 > Slack Notification Plugin をインストール。

インストールが完了したら、通知設定をします。
Jenkinsの管理 > システムの設定 > Global Slack Notifier Settings
(バージョンの違いかわかりませんが、Slack公式ドキュメント記載のIntegration Tokenの欄はありませんでした。)

項目 入力値
Slack compatible app URL https://{ワークスペース名}.slack.com/services/hooks/jenkins-ci/
Team Subdomain ワークスペース名
Integration Token Credential ID 認証情報の追加 → 種類:SecretText > Secret:Slackで発行されたトークン ID:任意の名前

[Test Connecting]でSuccessになればOK

Slack設定が完了したら、あとは通知対象のジョブの設定をします。
ジョブ > 設定 > ビルド後の処理:Slack Notifications を選択。

以上で設定完了です。
ジョブのビルドが走ると、Slackにメッセージがとんできます。

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